Archive for the 'Uncategorized' Category

2012 in review

The stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 35,000 views in 2012. If each view were a film, this blog would power 8 Film Festivals

Click here to see the complete report.


GIS and Crime Fighting

In Oct 2000 CBS launched a new TV show named “The District”. For those that don’t remember it, it starred Craig T. Nelson as Chief Jack Mannion, chief of the Washington D.C. police department. During each episode there was a few minutes that the chief used the department’s GIS system to help solve the crime of the week. Now being the GIS geek that I was back then (side note: I was using ESRI 3.X and AutoCAD back then) and my first career was law enforcement with the Army, I was hooked on watching it each week. The GIS system that was used on the show was ESRI based. If you watch close enough and knew the software you could see the little clues.

In the early years of GIS not many cities or other government police department were aware of GIS or how to use it to fight crime. Now just about every major city or county police force use it to some extends. Just do a search on sex offenders in your area and you will get a web based map with convicted sex offenders located on it. GIS is also being used to track other crimes and activities with that info (in limited form) available to the public by web mapping today. But did you know that back in 1998 the City of Oakland CA. launched a web site named Crime Watch. This was 2 years early than CBS aired “The District”. A web based map showing the residents of  Oakland where crimes were reported in the city.

Crime Watch was one of the first web based mapping systems that the general public could use. Built on Autodesk Map Guide 4.0 it allowed a visitor to the site to enter an address and then it return a map of that area with the reported crimes, as symbols related to the crime, on the map. Web base mapping has improved since the Crime Watch days along with Map Guide. With open source applications and Google Maps almost anyone can set up their own Crime Watch.

Now don’t think that because you may not have a Map Guide Enterprise site to map out the crime in your city or any other GIS Enterprise for that matter you can not use GIS to fight crime. With AutoCAD MAP 3D you can still fight crime and track it on your desktops. By using SDF data you can create the data to analysis with buffers and overlays. Using a polygon feature to show known gang territories and with points features for major crimes you can do basic analysis to help  solve those crimes or curtail the gang activities. Adding traffic accidents into the maps you can pin point areas that may need extra patrols. Of course most major police departments know this already but the great thing about using the GIS capabilities in AutoCAD MAP 3D is you can display that data, plot it out and use those printed maps to show city administers and budget controllers why you need the funding for those projects. Even in courts, evidences can be presented to the jurors and the court to get rulings that may have been impossible before.

So if you are with a small government agency with a limited police force inform them that AutoCAD MAP 3D can help take a bite out of crime.

Map3D and 64bit ODBC Connections

So with more users upgrading to 64 bit operating systems more are failing to connect to their access or excel files. Maybe you try to drag and drop a mdb file on the Map Explorer or tried to use a ODBC connection in the Data Connect. Did you get one of these messages to popup?


DataConnectFail   FailToConnect

Well the problem is Windows 64 bit does not have any ODBC drivers for Access or Excel files. If you look at the ODBC connection manager all we see are the drivers for SQL. 


So what is a user to do? Well we can not throw out the new OS and reinstall a 32 bit OS, but we can do  something else. If you are on subscription you can still install and run AutoCAD Map3D 2009 which is a 32 bit application and will run on a 64 bit OS if you install the correct version that needs to be downloaded. Check with your reseller on getting the link to download or contact support on your subscription site. Once you installed the 2009 version on your 64 bit system you can now make an ODBC connection to our files. However you can not use the ODBC Connection Manager from the control center. You need to use the ODBC Connection Manger for 32 bit. Browse to the folder  C:\Windows\SysWOW64 and locate odbcad32.exe. This will allow you to set up your ODBC connection for a 32 bit application.


Now you can use your mdb and xls file again. Just remember you need to use AutoCAD Map 3D 2009. Obvious you do not want to use 2009 forever otherwise you would not have updated, so now may be time to start looking at copying your data to SQL databases. And before users start complaining that Autodesk is not taking care of it’s long time users and leaving them out in the rain, I can ensure you that Autodesk along with other software developers are on Microsoft’s case trying to get ODBC drivers for 64 bit OS.

LandXML files in Map3D

With 2010 Version of Map 3D we now have a way to import Land XML files using the survey tab of the task pane. However it only brings in points. What if that file contains line features or even yet a pipe network with structures from a Civil 3D project? Autodesk reply is use SDF, Civil 3D can export to SDF and then we can connect to it using the data connect. Well great if how ever creates that project uses Civil 3D but what about all those other Civil design applications that export to LandXML format?  So what’s your’ opintion on it? Should Map3D users have more functions in the Survey tab for line work and the points or how about a data provider (FDO) for LandXML.

Take the poll and vote, I’ll pass the results on to those that I can at the Map3D team of Autodesk.

Create a New SDF Schema

Have you noticed the Schema icon in the Map Explorer tab and noticed you can create a new SDF or SHP schema? I bet you tried it and got unexpected results. So what is it for and how do you use it? The Help files did not explain it when you clicked on the HELP button either.

Here’s a little tutorial on how to use it. First off what it does is create an empty file with a standard schema, a schema for today’s lesson is the table that holds all the feature values. The default schema contains only two properties, the feature ID (FeatID) and the Geometry but it allows us to add more properties or columns to the data table.  So Click on Create SDF… and follow along.

When we create a new schema it wants us to name the file and where to place the file using the standard file dialog box, after you name the new file and click OK it wants to know the coordinate system to assign to the schema. The dialog for this is straight forward so I will not go into this.

The next dialog box is the schema editor, this is where we add new properties to the schema, provide a more realistic name for the schema and a few more options.

Like anything else we need to do some pre-planning as to what properties we want to use, what data type are those properties (string, dates, Boolean, numbers) and what  type of geometry (points, polylines, polygons) we need to create. My SDF example will be for a point feature for automobiles (auto) and have properties for manufacturer, date it was purchased, who it is assigned to, model type and of course the feature ID.

            Start off by renaming the schema to “Autos” by highlighting the default schema under the Schemas in the left side of the dialog and entering the new name on the right side. You may need to expand the Schemas tree to highlight the default schema.






    Once you click the OK or Apply button you can not edit the schema any more. To move around or apply the changes just click on the schema name or one of the feature classes on the left side of the dialog.

     After you rename the schema, expand the schema tree to see the feature class (rename it to cars) and the properties, there are two properties by default, the FeatID and the Geometry. The FeatID does not need to be edited but the Geometry needs to be changed to allow only point geometry.  Highlight the geometry property in the tree and under the data attribute section on the right change the Geometry type to 1(point) by clicking on the text box and select the point by removing the check mark on the other two types (Curves & Surfaces). The curve type is for polylines and surface is for polygons.


Editing the geometry type. 

After you set the geometry type, click on the feature name (cars) NOT on the APPLY or OK buttons. With the Feature name highlighted click on New Property from the top menu.  


Creating a New Property  

Name the new property Manufacturer, leave the type as data and add a description. In the Data Attributes section set the data type to string and the length to 10.  


The Manufacturer Property   (Misspelled on purpose)  

Next create another new property and name it “Purchase_date”. Keep the default type as data but change the Data Attribute for data type to Date time. This will make that field a date format, MM/DD/YYYY and allow a pop-up calendar to select the date when you edit the field. Next create a property name it Assign, keep it as a string data and set the length to 25, the length attribute needs to be large enough to hold the complete name of the person that is assigned to that car. Last we create a new property for the model type of the vehicle my example is using model types of “Luxury, Sport, and Hybrid”. Keep the data type as string but instead of setting a length and allowing the user to enter “Luxery” instead of Luxury we create a constraint and a list of values that are acceptable for the field value.  


The Constrain Type. 

To do this under the Data Attributes in the “Constraint Type” identifier use the drop down list and select “List”. A new identifier will be listed in the Data Attributes identifier list named “Value List” and a value of Collection. When you select (click on) the identifier an ellipse icon will display next to the value, click on it to open up the “String List Editor”. This dialog will allow you to enter the values you want to restrict for that field. In the string list editor enter Luxury, Sport and Hybrid using the semicolon as a separator between the values.  


The String List Editor. 

Now we have all the properties and attributes for our new SDF schema we can click Apply and OK. After you click OK/Apply you will get an Error Message in MAP3D, this is normal and you can ignore it this time. 


Error Message on applying the new schema. 

Now use the display manger and right on the Cars Layer and Create a new cars point, pick a point for the feature and enter some values in the data table. When you select on the purchase_date column the current date is enter and a drop down arrow icon is displayed, clicking on the arrow will open up a calendar allowing you to select another date. 


Adding a New Feature and the Attributes. 

For the model value we told the schema that we only wanted Luxury, Sport or Hybrid as the values, BUT we can enter Junk at this time however if we check in the feature we will get an error.  


Enter Junk for Model. 


The Junk Value Error Message.  

Because Junk is not an acceptable value we get the warning and the feature did not get checked in nor written back to the SDF file. This is one warning you can not ignore and needs to be corrected.  Just go back and add an acceptable value then check the feature in.  

Summery: Now you can start creating SDF or SHP files from scratch or using standard AutoCAD geometry and add “your” attributes to those features using FDO and not having to create Object Data or Object Classes then export the way we did prior in previous releases of AutoCAD Map.  Try it out and let me know what features you want in the schema editor or data tables. Last don’t forget after you create the new schema to create the Meta Data for it, if you are using Map 3D 2008 you have the tools to do this easy.

Annotation Blocks Manipulation

Do you need to use annotation blocks to label some of your features and want to combine different values. For example you want a label with the value coming from an object data table field 1 & field 3 and maybe you want to add extra text at the end of the value. Maybe you want to use the area property of a polygon but need to round the value up.

Well you can with using a couple LISP functions in the value expression. Do not worry about having to write a lisp routine, it’s not that hard just keep in mind the parentheses matching must follow a set of rules. Sort of like in a math expression you need the same number of right parentheses to match the number of left parentheses and AutoCAD process them in matching groups or list. The one important item of using object data or object properties in an annotation block expression is the field or property type. Integers, character, real or point for object data type and integer or strings for the object properties.

In my example I have OD with a field for house number (house_num) and a field for the street name (street_nam) in an OD table named Parcels. I want to create a label with the complete address such as 123 Main. To do this with a lisp expression I use the STRCAT function like so:

(STRCAT :house_num@parcel “ “:street_nam@parcel)

What this means in layman terms or something you might understand is the first part is the left parentheses ( followed by STRCAT, strcat stands for string concatenation, the next part :house_num@parcel get the house_num field value from the parcel OD table. Next we have two double quotes with a space between, this will place a space between the two OD field values, otherwise we have 123Main, next we have :street_nam@parcel, this returns the street name from the parcel OD table, last we close it out with the right parentheses.

Now let’s say we need a label that lists the area of a polygon but instead of having all those places behind the decimal we want to round it up or down to the closest whole number. In this case we use the lisp function RTOS, RTOS stands for Real TO String, with the area property of a polygon the value type is a REAL so we convert it to a string and tell it what format and the number of decimal places to use for the string. It would look like this:

(RTOS .area 2, 0)

We start again with the left parenthesis ( followed by RTOS then .area. The (dot) .area will return the property area of the object. Next we have two numbers separated by the comma, the first number is for the unit format we want the value to be converted to.

1-Scientific 2-Decimal 3-Engineering (feet and decimal inches) 4-Architectural (feet and fractional inches) 5-Fractional

The second number is for the precision, if we use 0 it rounds the value to the nearest whole number, 1 will be one decimal place,2 will be two decimal places, and etc. Then we close it with the right parenthesis

How if you want to combine the STRCAT and RTOS functions together we can, say we want the area of the polygon and a suffix of Sq Ft. We can use something like this:

(STRCAT (RTOS .area 2, 0) “ Sq Ft”)

Notice the (RTOS .area 2, 0) is grouped together then it is grouped inside the STRCAT “ Sq Ft” list. This returns the area in decimal format with no decimal places and then concocts it with the Sq Ft string.

So there you have it a few simple lisp expressions that will allow you to manipulate your expressions values to create some labels with out having to fiddle with multiple attribute tags and text justification. Note these work in the annotation blocks and if you try using them in the style editor for data connect (FDO) data they do not work, I’ll post a few tips to get good looking labels using FDO later.

Contours from Shape Files with Elevations

Do you have a contour line file that is in ESRI shp format and need to create a civil surface from it or need the contour lines to be at their correct elevation? You can import it and create Object Data from the lines’ attributes then perform an alter-properties query to set the lines at their correct elevations.

Start by using the map import command to import the shp file, located on the Map menu Tools > Import. Browse to the shp file and select it. For those not familiar with the shape format there needs to be at least 3 files that make up the ESRI shape format. (shp, shx, & dbf) When using the map import you only will see the file with the shp extension.


After you select the file and click OK the Import dialog box displays allowing you some options to set for the import, like the coordinate system transformation or doing a spatial filter and a few more. The only one we need to set is the “Data”. We will convert the shape file attributes into object data.


In the column on the lower half of the dialog click on <None> under the column labeled Data. Then click on the ellipse icon (the 3 dots). This will display the Attribute Data dialog. In this dialog we select “Create object Data” and use the default Object Data table name which is the name of the shape file. Note: Map 3D 20008 versions prefixed with the word “Default” you can rename it if you desire.


You can click on the “Select Fields..” button and see what attributes will be converted and what Map 3D will name the Object Data (OD) fields. This is a good step to ensure there is a field that contains the elevation and it gets converted to the OD. After you view the fields/attributes select OK and OK in the Attribute Data dialog. Select OK in the Import Dialog and wait for the import to happen, the command line will let you know that X number of objects imported. Do a zoom extends and you should see the contour lines.

With the property palette open select a contour line and check that there is an OD table attached to the line and notice that the elevation is listed under the OD table and that the elevation for the Geometry is at “0”.


To get the OD Elevation value to the Geometry we need to perform an alter-property query on the drawing. Start by saving the drawing and close it, then open a new blank drawing or the project you need the contours in.

We start this by attaching the contour drawing that we just saved and closed, in the Map task pane on the map explorer tab right click the Drawing folder and select “Attach”.


Browse to the drawing and highlight it by selecting the name then click the “Add” button then click OK. The drawing should now be listed under the Drawings folder in the Map Explorer.

Now we need to get started on the query. On the Map Explorer, right quick on “Current Query” under the Query Library and select “Define”.


In the Define Query Dialog we need to click “Location” for the query type then select “All” in the Location Condition dialog then click OK. Next we click on the “Alter Properties” button in the option section of the dialog box.


In the “Set Property Altercations” dialog Click on the radio button next to Elevation in the Select Property section.


Now click on the Expression button to open up the Property Altercation Expression dialog. Expand the tree to get to the Object data field that contains the elevation. Highlight it by clicking on it and then click OK.


Back in the Set Property Altercations” dialog click on the “Add” button.


At this point we can click OK and return to the Define Query dialog select “Draw” for the query mode and execute the query.

HOWEVER! I want to go one step further with my query and set the major contours on a separate layer named Major and the minor contours on a layer named Minors. I can do this because my OD has one field in my sample named IsMajor. (see above screen shot) The values are 1 & 0, 1 for a major contour, 0 for minor. I am going to alter the layer property for the contours line by setting up a range table and use that for to place the contours on the correct layer. To do this while still in the “Set Property Altercations” I select the radio button next to the ‘Layer” property..


Then click on the “Range” button to start creating a range table.


In the Define Range Table dialog click new and give the range table a name then click OK. The next step is setting the conditions to use for the ranges. This takes knowing what the current OD values are and what you want to return the values as. In my case the values are 1 or 0, and I want them to return either “Major” or “Minor”. For my example it would be like so: In the Condition section, the operator is the equal sign (=) the “Expression Value” I type in 1 then in “Return Value” I type in Major. Then click the Add button.


Next I set the condition for the minor the same way, operator is the equal sign, for the “Expression Value” I type in 0, and for the “Return Value” I type in Minor, click the Add button again.



Once we set both conditions we can click OK. Now we need to set the rest of the alter property parameters. Back in the “Set Property Altercations” dialog, we click on the expression button and select the IsMajor field from the OD table.


After we OK the Property Altercation Expression and return to the “Set Property Altercations” dialog we select the range table we created from the drop down list and click Add.


We should now have two conditions or statements listed in the dialog.


We can now click OK and return to the Define Query dialog, make sure the query mode is set to Draw, and execute the query.

If everything worked right now we can open up the Layer Property Manager and set the color, line type or lineweight to the “new” layers to display the contour lines.


So with a little practice and trial and error we can take a simple 2d shape file and import then query it to make a good 3D drawing with proper elevations and display capabilities.


Readers Locations

Top Rated posts

Chat room