Showing posts with label Tips and Tricks. Show all posts
Showing posts with label Tips and Tricks. Show all posts

Thursday, March 19, 2015

Maplet - Adding Web Mapping Services to ArcMap

Another Maplet for my blogpost today. This one is about using Web Mapping Services. A Web Mapping Service, or WMS, is a method for sharing imagery across the web. It's a great option for being able to share and make GIS data available for others without having to transfer files. It's pretty easy to use as well.  A WMS is purely raster, so imagery is the best use, although I've seen people publish GIS data this way as it forces a specific appearance on the data - the drawback to that is the data is not available to the user to query against.
  WMS in an open standard and is managed through the Open Geospatial Consortium. The standards are available here.
  Here's the Maplet:

Tuesday, February 24, 2015

Maplet - Splitting Datasets by Attribute

Today's blog is another Maplet for ArcGIS 10. A coworker was wanting to know how to split a dataset into parts based on an attribute, so here is a short video with a couple of ways. For just a few elements, it can be just as quick to do a definition query for each of the fields and then do a data export. You can do the same just by selecting an attribute, and exporting, but you have to remember to only export the selected features.
  I also showed a neat little tool developed by Tim Fox of the USGS that automates the process. This can be a real time saver when there are more than a few attributes you want to use. Here is the link to the USGS tool.

Now, the video.

Wednesday, February 18, 2015

Time to get blogging again - I posted a new Maplet


Time goes by, and I periodically remind myself that I need to get back to my blogging. Well, no time like now. I'm starting with the announcement of a new Maplet - one of my GIS tips. This one is for ArcGIS 10 (specifically 10.2.2 but should work in all the 10s). I've had a few clients ask about this technique, so I thought I'd post it online as a reference.

The technique is for clipping imagery to a boundary. Specifically this is an issue where you may have a large photomosaic set in an ECW or similar file format that requires a rectangular dataset, but your imagery is made up of a non-rectangular tiles combined. The area not covered by images becomes a blank white area. That doesn't work too well when you're overlaying different datasets, particularly if you are overlaying different imagery sets at different scales.

Most of the time, this white border, or collar as it is sometimes called, can be removed by assigning the color value of the collar as a background color and set to not display, but in this case, the border is a range of color values. In this case, the trick is to have a boundary around the actual image area and use that boundary as a clipping edge.

The tricky part is finding where to do this. It is found in the Image Analysis from the Windows pull-down.

  Check out the video for details:



Wednesday, January 23, 2013

The Power of 10: Filtering Contours with Map

This is a reprint from an earlier blog (February 28, 2012) that is no longer available online.

The Power of 10: Filtering Contours with Map

I was recently working with a client, and he was working on a project where he needed to show contour lines in the area as a reference. The particular job didn’t need any kind of surface, just show contour lines as a reference. Luckily, the local city had complete coverage of his project area. The data was 1’ contours in an ESRI shape file. That was way too detailed for the project, so he needed a way to thin down the contour lines (no AutoCAD Civil 3D needed here – no surface or analysis needed). As a matter of fact, he really wanted only 10’ contours. What he needed was a query to filter out the other contours. In this case, identifying the desired contours is pretty easy – they all end in 0.
Some folks create their contour data and using a string (text) data type. In such a case, it can pretty easy to do in a single step – use the substring function (from the Text Function list) to select all the features where the final character of the elevation attribute is equal to 0 – be sure to add quotes to the 0 to show text rather than numbers.
When the field is numeric, there is a just a little more to do. In this case we need to find all the contours whose elevation is divisible by 10. So how do we do that in a query? The trick is to divide the value by 10 and evaluate the remainder. If the remainder is 0, we know that it is divisible by 10. To do this in our AutoCAD Map, we first create a calculated field where we capture the remainder and then run a filter query to select only the values that have a remainder of 0. Let’s take a look.
First, right click on the layer to Create a Calculation.
Then when the dialog box appears (this should look familiar), give it a meaningful name, go to the math functions and select remainder, and then replace the number place holder with your elevation field and the divisor by 10. Click validate to ensure the calculation doesn’t have any problems (keep in mind this can only check for appropriate field types vs actions – it has no way to check if this is what you really want to do) and then ok.Check the table to take a look at the result to see if it gives you the result you’re looking for.
Now that we have the remainder field, we can use it to filter the data. In the Create Query dialog, set the remainder property equal to 0, validate and hit ok.
Now your contours should only show those 10’ contours, and we can see how to use calculations can enhance our ability to select and show data.
Check out my video of the process.

Property Alterations: Get Elevations from Layer Names

This is a reprint of an earlier blog (January 16, 2012) that is no longer available online.

Every once in a while, I run across an AutoCAD drawing with contour lines that are 2d polylines with an elevation of zero, but the actual elevation is the layer name. While they appear as contour lines, that’s not a very useful format for the modeling world – particularly for Civil 3D users that want to use the polyline contours to create a surface. These files usually come from a GIS conversion process, typically where the GIS provider doesn’t understand DWGs and AutoCAD modeling. Often the data started as a shape file, and someone converts it to a DWG and sets the elevation property as the layer name.
There’s a relatively simple way to change it to a more useful format. The trick is to use AutoCAD Map 3D’s Drawing Attach command (found on the task Pane under the Map Explorer tab).
Select the DWG with contours and add them to the selection set shown in the bottom box and hit OK. The DWG file will show up under the Drawings folder on the Map Explorer.
You can select the Drawings folder, right click and select Quick View, make sure the Zoom to the Extents button is flagged, and hit enter. That will set your drawing extents to match the contour drawing extents – it becomes a visual to check progress. Remember, a Quick View is only a view, and will disappear with a regen.
When that is finished, select the Current Query under the Query Library on the Map Explorer.
On the Define Query dialog, hit the Location Query Type and set to All, and then under Options, select Alter Properties.
On the Set Property Alterations dialog, select the Elevation property (this is the property we want to change) and then select the Expression button.
Expand the Properties folder (this is all of the objects AutoCAD properties) and select Layer. This will set the Layer name as the data source.
Select the Add and it will create the expression in the box at the top of the dialog. This will tell the query command to copy the value from the Layer name to the Elevation. In this case it will work because the layer name is a number. If it was not a number, this wouldn’t work the same way.
When you get ready to run the query, be sure to set the Query Mode to Draw. The when you execute the query, the contour lines will be copied into your current drawing and the elevations should now match the layer name.
Check out my video on this on the CADsoft YouTube channel:

Don’t forget your AutoCAD tools – Qselect

This is a reprint from an earlier blog (May 27, 2011) that is no longer available online.

Sometimes when using vertical versions of AutoCAD (like AutoCAD Map, Civil 3D, Architecture, etc), is that you can get entrenched in the vertical tools and forget that it is still AutoCAD, and so you have all those rich AutoCAD tools available. Recently while working with a client, one of these came up. The tool in question was QSelect. Now, I don’t know when QSelect initially showed up – for years I used LISP routines to do advanced selection, and one day several releases ago I stumbled across QSelect. It has been a great friend to me ever since – particularly working in the GIS world.
In this case, they have a drawing with areas defined as numbered zones. The drawing was created to show boundaries in individual sheets rather than build polygon data sets. There are labels along the lines throughout the data, duplicating where they will show on the sheets.

These drawings have been in use for some time, and they wanted to turn these into a polygon feature class. Generating a polygon feature class is pretty basic, and there are several ways. I like to get a clean data set without slivers or gaps, so using Map’s topology tools are a great way to get clean data and converting to a feature set is easy. The process forces you to clean the polygon data, and then create the topology. One challenge is that you can only have one centroid in each polygon. The text labels already exist, so they are perfect to use as centroids. The problem is there are too many. Erasing them individually is painful as well. You could write, or find, a LISP routine to prune down the number of labels. Or you can use the QSelect. With QSelect, I can build a selection set by querying various properties of the objects. In this case, select an object type (MText), a property (contents=the actual value of the text) and set an equals operator to find MText objects whose contents = Zone 36a (you don’t use a text identifier such as “” here).

Now I have a selection set of all the text labels in Zone 36a (you can see by all the grips on the selected text). The next step is to escape to drop the selection set (so we can manipulate it later). Now start the erase command, and when it prompts to select objects, type P to get the previous selection set (this grabs all of the queried text labels). Now change the selection prompt to remove mode (removes objects from the selection set) by typing R, and pick one of the labels to remove it from the selection set and enter to complete the command. At this point, there will only be one label for that polygon. Do this for each polygon, and you will be ready to use them for labels.
Now, I wouldn’t use this for a dataset with thousands of polygons, but it is a quick and easy way to remove some tedium when preparing a relatively small dataset.

Creating AutoCAD Text from Geospatial Datasets

This is a reprint from an earlier blog (August 9, 2010) that is no longer online.

In this tip, I’m going to convert attribute information from a data set in ESRI Shape format, and create a text label from that attribute. There are a couple of techniques, but in this case, I’ll show a quick and easy technique to create AutoCAD text labels from a connected shape dataset using an FDO connection.
Start with a new drawing, assign the coordinate system and create a connection to the data set to label.

Add the data to the map, and the dataset will show up in my Display Manager.

Once the data connection established, create a style and hit the feature label option. This will open the Style Label dialog box where all the settings are to get the labels to look the way you want.

Going down the dialog box, set the Multiline Option (the Advanced Placement option will set the text to follow the line, which you may want for certain conditions, but the text can end up in separate text entities for every letter – that may be ok – it depends on what you are looking for).
The next item is to identify what property (attribute item) you want to use for your label. If you have an attribute that is exactly what you want, you can set it and be done. In some cases, you may want to modify the value or even combine several elements of the text. To add pipe sizes, take the size and add an inch symbol (the double quote) – so an 8” line will read 8”. You could add material so the label reads 12” PVC, or if doing street names, you might want to combine the street number, direction, name and type to get a complete street name. To modify this, select expression here. This will open the Map Expression Builder dialog box.

There are a lot of options for creating text labels from data, calculations, or other elements. In this case, I want to place some text elements together. The function to combine text is concatenate, which I can find under the text functions under Concat.

Selecting the function places the text and format in the expression window. The function works on the elements contained in the following parenthesis, and the bracketed text property are place holders for the text elements. To get the pipe size and combine it with an inch symbol, replace the first Text Property with the value for the size, and the second with the “ symbol (surrounded by single quotes to show it’s a text value – ‘”’). You can continue to add pieces of text until you get the desired label. To add attribute values, such as the size, use the Property menu and the list of attributes will be there sorted by the type of field. I’ll select the size, and complete the expression – Concat ( SIZE , ‘”‘ ). For street names, an expression might be concat( ST_DIR, “ “, ST_NAME, “ “, ST_TYPE) where the “ “ is used to add spaces between the fields.

You can use any combination of data fields and other elements to create a label with this expression process.
Once the expression is set, you can set the display parameters such as size, color and font. Remember with the size, Map Space is scale relative to the model and set the height to a specific value, while device space is relative to the monitor, or view, and will change the physical height based on the zoom scale.

Once the labels are set how we want them, we can go to the Display Manager and select Save Current Map to DWG from the Tools menu.

After saving to a new drawing file, we can open the file and the labels are now standard AutoCAD text items along with the roads. The process actually takes more to write about than to actually do.

Next post, I’ll go the other direction. I’ll show how to grab labels and turn them into attributes.

Getting Your Results – Using Network Topologies

This is a reprint from my earlier blog (May 7, 2010) that is no longer available.

One of the important tools that AutoCAD Map 3D includes is the capability to work with topologies. It can create and manage them, and more importantly, do analysis from these topologies. Basic training classes, and all of the books I’ve seen, show how to create, manage and perform analysis with topologies. One thing that is absent, is how to take advantage of and access the results after the analysis – it’s the cause of a lot of questions from people I work with.
Before I get on to working with the results, I want to give some background of topologies, and how AutoCAD Map 3D manages them.
Topology is a technique for managing spatial relationships between objects. It is a particularly useful technique for managing networks of objects, such as utilities or streets. The relationships allow you to trace up- or downstream to answer questions, such as:
  • What customers will be out of power if this line is down?
  • What is the likely source of contaminant (common point upstream) when there are a series of sites that are showing high levels of contaminants?
  • What is the shortest route between two locations?
The relationships are created by maintaining unique identifiers for each point or junction and line in data tables. These identifiers are called Primary Keys. The lines will also contain fields to include the identifiers of the points from each end of the line. These are called Foreign Keys. By searching for lines that have a specific point identifier, you can find all the lines that connect to a point, and go from point to associate line to associated point to associated line, etc, much like a monkey swinging from one vine to the next.
Consider the example below. Here is a collection of lines and points. There is graphic representation of the network, and a snapshot of the data tables from the network. Look at point # 2364. It appears to be the end of
that particular network stream. We look for all of the lines that have either a start point or end point value equal to 2364, and we find that line # 6888 has 2364 as an end point. We then look at the other point value and find it is 2359 (the start point and end point allow a topology to show direction as well as just connections), so we search the line table for other lines that have that value. We will find line #’s 6887 and 6921. We can then continue in this process until we get the results we are looking for. For a best route, we will evaluate the potential sets of lines that provide a connection between the two points, and use some criteria to determine the best (usually the shortest lengths) set or route.
AutoCAD Map 3D provides tools and the data structures to create and manage topologies, as well as topology analysis tools. Within the Task-based Workspace, the topology commands can be found on the Object Map ribbon on the Topology panel. The only thing required to create a network topology is a clean network of lines (clean means that the end of one line exactly meets another line – their coordinates should match). Map 3D will create points (called Nodes) at the junction points if they don’t exist in the data.
Once a network topology is created, Map 3D will create Object Data to manage to topological relationships. The nodes will get a table called TPMNODE_topologyname (where topologyname is the name of the topology). You can use the Edit Object Data command (The Object Data panel of the Object Map ribbon) to select a node and review the table information. The ID field is the critical element (the resistance values can be used to manipulate the analysis – for example, the resistance on a point could be a time factor for an average stop at a stop sign so route can be qualitatively compared including stops, turns, etc).

You can also see the values of the object data by selecting an object and reviewing the Properties (on newer versions of map 3D).


The lines (Map 3D calls them LINKS) will get their own set of Object Data, called TPMLINK_topologyname. The line (or link) object data will include additional fields. The critical elements are the Start_Node and End_Node fields, which are how Map 3D manages the topology relationships.


The purpose of creating and managing topology is to perform analysis, and the tools are also available on the Topology panel of the Object Map ribbon. The three network analysis tools are Shortest Path, Best Route and Flood Trace.

When completing the analysis, you have the option of highlighting the results with a color (it will go away with the next redraw), or save to a topology. You will give the results a name (my example attached was a flood trace, and I named the resulting topology FloodResults).

Once the topology is created, I can always re-highlight the topology, but it goes away with each redraw. That makes it a bit difficult to use for further analysis or to even print the results.

The easy way to work with them at this point is to save the drawing with the result topology (or topologies) and open a new drawing. In the new drawing, use the Map 3D drawing attach tools to connect to the results drawing.

In the Map Explorer of the Task Pane, the topologies from the attached drawing will be visible in a greyed out icon. This means the topology hasn’t been loaded into the current drawing.
Right-click on the result topology and select the Load Topology option under the Administration menu.

This will open a dialog box with the option to Create objects when loaded. Selecting this will recreate the topology objects in the current drawing, essentially making a copy of the topology data from the original file.

You may have to Zoom Extents to see the newly created data.

At this point, we now have just the objects and topology from the result topology we created. We can save this and have it available for future applications and uses, such as printing route maps or performing buffers, etc. In addition, the objects will have not only the object data from the results topology, but it will also have the data from the original topology and any object data from the original objects.

Some new AutoCAD Map 3D Installation Help

This is a reprint from my earlier blog (April 13, 2010) that is no longer online.

Katie Jacques from Autodesk has posted an item on the new Installation & Licensing forum listing some new videos for installing Map 3D 2011. It covers network and stand alone installs, creating deployments and post install tasks. So if you’re planning your upgrade, it could prove to be quite helpful.
Check it out!

Get Your Head in the Clouds

This is a reprint from an earlier blog (ember 18, 2009) that is no longer available.

Geospatial applications are renowned devourers of information. As new technologies for capturing data are developed, the geospatial applications soon follow. It makes sense as we try to find better and cheaper methods of modeling our world. One of these technologies is LIDAR (Light Detection And Ranging). LIDAR is becoming a common remote sensing technique. It sends out and measures the return of laser pulses to determine distances (as well as other information) in 3 dimensions to essentially generate a 3D view of the scanners environment. The resulting data is a very large group, or cloud of X, Y and Z values (along with other descriptive information depending on the equipment and technique). These point clouds have required specialized software to view and capture information.
Now, subscription AutoCAD Map 3D and Civil 3D users have some new tools available to work with these point clouds. The new Subscription Advantage Packs include tools for viewing and classifying Point Clouds. This can be incredibly useful to geospatial users. At a large private electric utility I used to work for, we used LIDAR as a method to survey electric transmission lines and surrounding vegetation. We were looking for trees that were growing into the lines and cause potential outages.
Clouds1After installing the new Subscription Advantage packs in AutoCAD Map 3D, some new options become available. In the Task Pane’s Display Manager Tab, there is a new option in the Data menu – “Add Point Cloud Data.” Selecting this option opens a file select dialog prompting for an ISD file – a Point Cloud index, or data store file. You create the index from the new Point Cloud Manager.

Clouds2Another new option is in the Tools menu – “Create Point Cloud Index.” This option opens the Point Cloud Manager.
From the Point Cloud Manager, we can add LIDAR data files to create a Point Cloud data store, merge them into groups, set coordinate systems, use filters to classify, create elevation ranges and even create spatial filters.


Clouds3
Adding the Point Cloud Data will create an entry in the Display Manager tab, and add a new Point Cloud ribbon giving us tools for stylization, exporting and creating surfaces.
Clouds4
Keep in mind, these data sets are big, and will tax your system resources, so be prepared.
So, get your head in the clouds and check it out. The view is great.
Clouds5

Wednesday, May 5, 2010

Try Out a Map Book


On the Task Pane of AutoCAD Map 3D, there is a series of tabs. I spend a lot of time demonstrating and talking about the first two, but I don’t spend much time on the third one – Map Book. The Map Book tab is simply a set of tools designed to help users generate an easily reproducible set of printed maps. It will generate a standard AutoCAD Sheet Set, but will include some tools specifically designed to simplify setting up a grid-based Sheet Set, complete with a key map and navigation features.





You can also have a number of Map Books defined. You may want different books for different utilities, or you may have different scales needed for different map sets. Moving back and forth is just a matter of selecting the appropriate map book at the top of the task pane.

Before creating a new map set, you need to make some decisions. You will need a template drawing file with a layout defined with a title block, and if desired, the adjacent navigation blocks, main, key view and legend viewports. There are a number of templates to use as examples that come with Map. You can find them with the other templates in \Documents and Settings\\Local Settings\Application Data\Autodesk\ AutoCAD Map 3D 2010\R17.2\enu\Templates. These templates may net perfectly suit your specific application, but they can give you some ideas.

You can open one of these and use the Identify Template Placeholders command from the Tools button to look through the settings.



Once you have everything ready, you can use the New button to start a new map book. As with most things Map, you will get a workflow-based dialog box. Go through each section of the dialog before closing the dialog or hitting the generate button.

First, you’ll set a name in the Source. You will select Map Display if you’re plotting objects from the Display Manager (primarily FDO connections) and Model Space if you’re selecting AutoCAD Objects. Remember, you can add Objects from model space into the map display.

Your next step is to select the template drawing file, with the Layout and Title Block you’ve setup. At this point you can add the links to adjacent sheets. You will also set the scale here.

Next, you will set up your map grid using a Tiling Scheme. You can set the grid based on the size of the map (area), by the number of sheets you want, or by selecting a premade grid made from existing closed polylines. You can also set a map overlap, so that you can have a strip of surrounding area. You do that with a percentage.






If you want to create an overlap, and still keep scale maps (I’m not sure who wouldn’t), a friend of mine, Jeremiah McKnelly wrote a great tip for getting true scale map books with an overlap. Check it out here.

The next step is to set a naming scheme for your grid. You have several options based on numbers, letters, or you can even use data from the drawing using the expression builder.

Next you can define your key drawing. You can use premade keys, or generate one on the fly by selecting the layers you want to show.

You can then add a legend where map will setup the viewport if you’ve already created a legend, or you can set up a space to add one later.

Finally, you get to define where you’ll put your sheet set definition file (.DST).

After all this, your Map Book tab will now display all the sheets with their views. You can check the properties of one of the views to see the adhacent sheet information stored. You will also see all of your new layouts, all named and ready to go.





The process allows you to very quickly layout some simple sheet sets with very minimal effort. If your organization needs to plot map books or sets of printed maps, this may be the right tool for