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

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:



Friday, March 19, 2010

Where'd My Property Go: Finding data during Splits and Merges

One of the challenges when working with geospatial systems is managing the data attributes when the object is split or combined with another. For example, if I have two parcels that are joining, and they have different Assessor Parcel Numbers (APNs), how do I get just one new APN from the 2 previous APNs. And what happens to the area field? Or when I split a parcel, how does the system name the 2 new parcels? More importantly, that about the ID field that serves as a key to link to other databases. The answer is that you can pretty much set it to do what you want. AutoCAD Map incorporated split and merge tools so that you can manage them. The following example should give you an idea of how to get started. The important thing is that like most things GIS, putting some thought into it prior to trying to do the work will give you the best results. In other words, design is very important.

My example will use a proposed forests data set. I have attributes for the proposed name, the area, perimeter, and the area in square kilometers and hectares. During the join, I want to rename to proposed forest, and update the area and perimeter fields.

NOTE: As I go through this, keep in mind the terminology gets wonky. The same words can be used to describe multiple elements of these objects. For example, the attributes of a feature can be called attributes, properties, fields and columns (to us database geeks), and the properties describing the said attributes, such as field size and type, can all use the same names. So, try not to read too much in the wording and I’ll try to match AutoCAD Map’s terminology.

To set the Split and Merge Rules, I will highlight the target data set in the Display Manager and open the Data Table.
OpenDataTable


Once I get the Data Table open, I’ll select the Options, and select Set Split and Merge Rules.


SelectDataTableOptions

At that point, I’ll get the Split and Merge Rules dialog box.
SMRulesDialog
At the left of the box, I get a list of all of the feature properties of the selected data set (attributes or database columns). As I select each of these properties, I get the various attributes of that property. It identifies whether the property is an Identifier, the data type of the property, whether it is autogenerated, read-only or nullable. In addition, I can set Split and Merge Rules for each property attribute. Keep in mind, the available Split and Merge Rules are context sensitive based on the data type (it’s a little tough to sum text fields).

The data set I’m using is an ESRI shape file, so there are certain feature properties that are inherent because of the type of data set. The FeatID is autogenerated and read only, so I won’t be able to set any rules for this one.

My ID field is an identifier for the individual forest polygons. I’ll set my Merge Rule to Empty. When merging, I’m going to create a new and distinct record from the previous record. This is a business rule I’ve decided upon so I can keep a history of forest proposals, even if they are not actually implemented.

My area field shows the area of the polygon. I could add the polygons, but for better results I can use an expression to calculate the actual area of the result. To do this, I set my Split rule to Calculation, and select the Expression Builder button (next to the Exporession box). I’ll select the Area2D from the Geometric pull down,

expressionarea
And then Geometry from the Property pulldown.
expressionGeometry

The resulting expression, Area2D(Geometry) , will calculate the area of the new polygon (if you know the expression, you could just type it in the box rather than going through the expression builder – but if I had done that, you wouldn’t have seen it, right?). That expression will go into both the split and merge rules.
My next feature property is the Perimeter, and guess what? There’s a calculation for that as well. Select Length2D in the Geometric pull down to get this expression: Length2D(Geometry)
On the Name feature property, I will generally not use the existing names – again a business decision. There are cases where I would want to keep one of the names (Using the FirstSelected or LastSelected rule) or concatenate the two names, just not for this case. In my example, I would need to add the name manually after doing the merge (or split).
My next feature property is AREASQKM, or the area in square kilomters. I can use the same expression as before, but include the conversion to square kilometers, giving me this expression: Area2D(Geometry)*0.00000009290304. Again this will apply to both split and merge.
My last standard property is HECTARES, which is the area in hectares. This will match the previous bit with the appropriate factor: Area2D(Geometry)*0.000009290304

Of course the last entry is Geometry, and you can’t use rules on geometry,

Adding Custom Linetypes

My last post was on the linetypes for feature objects in map 3D. There are a lot of options, but it isn't as open as using AutoCAD linetypes. You can create additional stylization, but it takes rolling up your sleeves. My next post was going to do that, but I don't have to - Murph did. So check out his post on adding custom linetypes, and I'll work on something else.

Finding Your "Type"

One of the common questions I after folks start working with Feature Data Object connections in AutoCAD Map 3D is how to use interesting linetypes in their maps. To add linetypes to FDO-connected data sources, select the ellipses next to the Thematic Rule in question, and the Style Line dialog box opens. There you can select the thickness, color and pattern for the line.
StyleLineBox

The pattern selection provides a set of linetypes – not the AutoCAD Linetypes (there is no direct way for users to modify this list, although it can be programmatically edited – more on this another time). This will provide a number of options and style combinations.
You can also stack line patterns to create more complex styles. For example, many road maps will use a red line with black borders for a highway, sometimes with a back center line or dashed line to show divided highways. This can be modeled by using several lines patterns overlying each other. StyleLineBoxexp
To do this, select the composite lines option. The Style Line dialog box will then expand to add a composite style box where you can add multiple line components.



HwyLineStyle
To make the example highway style, add 2 new lines by clicking the New button at the top of the composite box. Select the line at the bottom, change it to a .2 cm thickness at black with a continuous pattern. Change the middle line in the box to a continuous red line with a width of .15 cm. Change the top line to a black line with a dashed pattern at a .1 cm thickness. The resulting line style will be apply to this theme rule throughout the drawing.

You can have different composite lines for each theme rule, allowing fairly complex maps. Combine these with some annotation patterns and you can make maps that look like the standard road maps from various publishers.