Monday, January 10, 2011

Putting 3D back in Map3D

A few days ago there was a question in the Autodesk news group about using a linked data source to drive the Z coordinate of polylines. The original poster wanted something that looked like the “Causeway in Ireland”. My first thought was if you have the data in Excel why not use the 3D graph tools in MS Office to create this. Then I thought,  that only gives you 3D columns, not the shape of the polylines of a map, and you would have to create a number of graphs to show all the values.  The user wanted to click once and have the new data displayed. So why not try it in Map3D?
Here’s a little information on the data and what I assumed they wanted. The drawing is of polylines that represent areas of a school district. The user is wanting to display each area in a 3D view with the height based on the ages of the population of that area. For those on this side of the Atlantic think TIGER data and the US census data.
We all know you can create a map theme based on data but it’s only 2D or a flat map.  How can you create a 3D map from the data? After getting a copy of the dwg and Excel file I made a few edits to the user’s drawing, created a few queries, and  created a few maps in the map display tab of the task pane. Here is a screen shot of the original dwg with the data linked.
Original_DWG
First thing I did was assign a color to each layer, then hatched each closed polyline.  I then linked each hatch to the same record as the polylines. I did this manually seeing there were only 10 it wasn’t too much of a task.
My edits are below.
Editted_DWG
After saving the dwg, I opened a new dwg, attached the original dwg along with making the data source connection to the Excel file. Next after doing a saveas on the new dwg I started writing some queries and saving the queries to two different categories, one for the polylines and one for that hatches. The queries are just simple alter-property queries.
Here is the start of the queries.
Define_queries
1. The query type is Property, and object type equals LWPOLYLINE.
2. The query mode is Draw.
3. The Alter Properties is as;
4. The Thickness (of the polyline)
5. I use the expression from the Link Table field.
6. Next I needed to add a little LISP expression to the expression. (explained later)
7. I save the query.
When I saved the query I created a category for it to make it easier to keep track of it later.
QuerySaves
Once I saved the query and OK out of the Define Query dialog. I did not run the query just yet. I repeat the steps to create more queries on the remaining fields in the linked table. Saving each to the same query category we created.
Note: the LISP expression I used with the expression
&”Aged 1 year”@001 in the alter property is to multiple the field value by 100. The purpose is to exaggerate the height (thickness)  of the  polylines when Map3D creates the new map display.
The final expression looked like this: (* 100 &”Aged 1 year”@001)
Next I created queries for the hatches in the drawing.  The query mode will still be property object type but this time I use Hatch instead of LWPolyline. In the property alter section I select Elevation instead of Thickness.  The expression for it will be the same. The other differences is when I save them I created a new category for the hatch queries.
When I was done creating all the queries, I have them listed in the Map Explorer tab of the task pane.
TheQueries
If you noticed the way I named the queries based on the field values, also the names for the polylines (Ages) category are a slight different than the ones for the Hatch category. The reason I used a different name is to keep Map3D from getting confused on the queries.  Yes I cheated a little bit, if I had created ALL the queries for this set of data I would have over 80 queries in each category.
The next step is creating new maps in the Display Manager. I switch to the DM of the task pane and create a new map.
CreateNewMap
I named the new map on the age group that will be displayed. Now that I have a new map I add drawing data to it by querying the source drawing (the original drawing that is attached).
Query_Source_DWG
In the Define Query of Attached drawings dialog I select Load query and select the query for the age group I saved in the category for the polylines and click OK. Switch to the 3D view (click on the 3D icon above the status bar or command line). The polylines now appear as 3D. However they do not look like a solid polygon.
display_plines
In order to make them appear as solid polygons is where the hatches and their queries come into play. Again I used the Add drawing data by querying source drawing and load the hatch query for the age group from the hatch category.  Now the polylines look as solid objects.
display_hatch
Another function I tinker with was the visual style, the default style is Conceptual. I opened the visual style manager (VSM at command line) and play with the settings until I got the results I liked. Hint: make a copy of the conceptual style and paste as a new style to tinker with.
Last I created more new maps and add drawing data by loading the appropriate  save queries for each map and it’s age group.   Once all the maps were created I able to change the display by opening one of the maps from the drop down list for the maps on the display manager.
maps
There you have it, a simple way of putting some 3D into your maps and drawings.

No comments:

Post a Comment