Showing posts with label projection. Show all posts
Showing posts with label projection. Show all posts

Monday, August 17, 2015

Higher Quality UTM Zones Map

Until now, an image from the Wikipedia article on the UTM coordinate system has been my go-to UTM Zone reference. It's pretty okay.



I threw together a map that has been a bit more helpful as it shows US counties and some basic hydrography -  mostly from ArcGIS Online layers, and default ArcMap Template data.


Friday, March 27, 2015

Repair Lat/Long Coordinate Errors on the Fly

Every once in a while, someone misses a step in processing raw lat/long coordinates. Sometimes data was transferred incorrectly, sometimes the data wasn't available.

Here's some data I threw together as an example - these are my favorite caving diving sites in Florida:

ID
Name
Latitude
Longitude
1Jackson Blue30.790475-85.140083
2Madison Blue30.48051883.244421
3Orange Grove30.127215-83.13053
4Peacock30.122503-83.1324
5Little River29.996677-82.966328
6Devil's Eye29.83509-82.69659
7Devil's Ear29.835297-82.696568
8Ginnie Spring29.836178-82.700148

Initial projection of data is missing a location


Something's wrong. I expected to see Madison Blue just north of that group of three points. (some of those spots are springs that are within a few hundred yards of each other.

! When projecting data, immediately zoom to that layer, or hit the Full Extent button  to ensure that all points were plotted properly.
ArcMap's Zoom to Full Extent tool
After I zoomed to the full extent of the data, I realized what must be wrong with the data (see below). Obviously there's a Longitude value that's missing its negative sign because I haven't been diving in India/Tibet before.

Zoom to full extent to check for mis-projected data.
A few quick tips:

  • Locations on the same latitude, but on the other side of the world are probably missing or adding a negative sign
  • Points off the coast of Nigeria/Ghana/Gabon, down under of Africa's west coast are probably inheriting a Null or erroneous value, so they're defaulting to the coordinate (0, 0).



  • After zooming to the full extent of a map, use the Select Features tool to select those incorrect locations. In the Attribute Table, choose Show selected Records to take a look at the incorrect data.


Fix the Data

  1. Start an Edit Session on that layer in question
  2. Select the erroneous site. Mine is ID = 2, or Name = Madison Blue
  3. From the Editor toolbar, choose the Sketch Properties button to open the Edit Sketch Properties window
  4. Add a negative in front of the selected X value and press Enter or click Finish Sketch to apply the update
  1. Save and Stop Editing
That's it! Piece of cake..

Corrected data plot

Wednesday, March 18, 2015

3D Flight Data Visualization


I recently came across some delicious raw data from a flight tracking tool. Here's what it looks like in 3D!

Grab Flight Data

  • Go to FlightAware.com
  • Search for a flight and select it to . I found a flight from Minneapolis to New York City - a flight I'd like to be riding right now
  • Click the track log & graph on the right information panel 
  • Open Excel, Google Sheets, etc.
  • Build the field headings separately since they don't select well with the data values from the Web page
  • Select the data from the page, and copy it
Copy the data by itself - Build/copy headings separately
  • Paste Special into your spreadsheet with text/values only - no formatting! If you directly paste the selection, there may be a bunch of graphic elements that migrate over too

Format & Convert

  • Fill in the gaps of any altitude values that aren't available. I used the Fill Down (Ctrl+D) tool to duplicate the previous reading
  • Make a new field called Linestring
  • Use this formula to concatenate Longitude, Latitude, and Altitude together, separated with commas. Fill this down for the entire dataset. We'll come back to this in a moment
=C2 & "," & B2 & "," & H2
  • Copy the following KML template and paste it into your favorite text editor (Notepad, Notepad++, Sublime Text, etc.)



  • Replace the comment on line 9 (<!-- Replace... -->, between the <coordinate> tags) with the data (not the field heading) of the new Linestring field
  • Save this as Flight Visualization.kml, or something appropriate

Display in Google Earth

  • Double click the new KML file to load in Google Earth
  • Expand the new folder until you find the Flight Path. Right click on that Path layer and choose Properties

  • Navigate to the Altitude Tab. Change the Altitude setting from Clamped to ground to Absolute. Make sure that Extend path to ground is checked
  • On the Style, Color tab, choose a bright red Lines color. Use a Width of 1.0. Set a 30% Opacity for the Area symbol. I like the Filled + Outlined setting
  • Play with these settings until you're happy. Click OK to start playing with your visualization

Wednesday, March 17, 2010

Georeferencing / Georectification / Geometric Correction in ArcMap

I've done some geometric correction using other software packages, but have not yet tried to do it in ArcMap.  It turns out that there's a pretty small learning curve in the world of georeferencing in ArcMap.  I recommend simply turning on the Georeferencing toolbar and playing around with the hand full of tools that it holds.  All of the most useful tools are hidden away in either the Georeferencing menu on the left of the toolbar or in the small menu of three manual alteration tools to the right of drop down menu of selectable layers.  In the hour or so that I have been attempting to georeference a couple images, I already want to pull the tools out of the drop down menus and place them on the main toolbar for faster access.


A screenshot of the Georeferencing toolbar in ArcMap


Turn on the Georeferencing toolbar:
To verify, turn on the Georeferenceing toolbar by either right clicking in empty gray space beside tool bars/file menus at the top of the ArcMap window, or by going to Tools :: Customize and on the Toolbars tab, place a check mark in the box next to the Georeferencing toolbar option (then click Close).  The toolbar (see above) will appear.

Add imagery:
Use the Add Data button to add a raw, unreferenced images (.jpg, .png, .bmp, etc.) to an ArcMap project.  Expect to receive an "Unknown Spatial Reference" message that explains that the image cannot be projected.  If there are spatial layers already added to the project, the images will probably be displayed somewhere off in a corner.  Right click on the image layer in the table of contents and select Zoom to Layer to view it.

Here are a few good resources to consider to obtain imagery:

Georeferencing:
I have access to rectified imagery and other reference datasets (transportation networks, hydrography, etc.) so I'll use those to illustrate some techniques (very quickly and roughly).  I'll just be using aerial imagery from 2005-2009 and a coverage of State Routes.
  • Zoom to the area where the image should cover.  This example is looking at an area in Florida around Taylor Creek, just north of Lake Okeechobee:











  • Choose an image to manipulate from the Layer menu on the Georeferencing toolbar

  • Since my .jpg image (in this case) is hiding down at the grid origin, somewhere in the Gulf of Mexico, I will have a hard time matching similar locations in the relation process.  Open the Georeferencing menu on the toolbar and select Fit to Display.  The image will shift into view and be resized to fill your map view.

  • Begin by using the three tools in the menu to the right of the Layer menu to roughly align the image:
    • Primarily, it seems that the images are rotated about 90° clockwise (north is pointing east). Use the Rotate tool to fix this. The original top of the raw JPEG is now facing west:
      (This can also be performed from the Georeferencing menu under Flip or Rotate :: Rotate Left)
Rotated the image 90° anti-clockwise so north
(Click to enlarge images)
    • Next, use the Scale tool to shrink the image a bit:
 
Shrink the image with the scale too
    • Finally, use the shift tool to move the image closer to its correct position:
 Moved the image using the shift tool
  •  Open the Link Table by clicking the button on the far right of the Georeferencing toolbar.  This will keep track of the control points that will be added in the next step.

  • Zoom in to a location that is easily distinguishable in the rectification image as well as any reference data.  Roadways are excellent references, especially when they intersect with each other or with a stream, etc.  A less effective reference feature can be a lake or stream, for example, because the shorelines can change over time.  Roadways often have less variation.  Local knowledge is very beneficial in these situations.

    Below is an example of a roadway intersection that is a decent enough reference point to use.  The red circle indicates where the control points will be placed:
(Broken GIF: the image should be animated
to illustrate the two control point locations)
  • Use the Add Control Points tool to add pairs of control points.  The first click will represent the "from" location that will correspond to a point on the image that is being rectified (the black & white image in this case).  The second click will represent the "to" position, where the image will be moved or stretched.  This pair of control points creates a vector that is used to rotate, stretch, and skew the image.

    Add a few of these control points across the extent of the rectification image.  Each time a control point is completed, the information will appear in the Link Table, and the image will move (if the Auto Adjust option is checked in the Georeferencing menu).

    Note the Total RMS Error that is reported in the lower right corner of the Link Table window.  Root Mean Square Error is "a measure of the difference between locations that are known and locations that have been interpolated or digitized" (Heather Kennedy. 2000. ESRI Dictionary of GIS Terminology, ESRI Press, Redlands, CA.). In general, lower values are desirable.  Read more about RMS Error.


  •  It helps to turn layers on and off in the table of contents pane.  Another useful technique is to use the Swipe Layer tool (found on the Effects toolbar).  Make sure that the image/layer/group layer is selected in the Effects toolbar selected layer menu, then select the Swipe Layer tool and click the map view.  Then simply click and drag the tool across a map to reveal lower layers on the map.
Image rectified with various control points
* Caution! Changing the selected layer on the
Georeferencing toolbar will remove any editing
or work that has been done to an image. Use the
following methods to preserve your referencing
Save image referencing:
  •  From the Georeferencing menu, simply choose Update Georeferencing
This adds two files ( [image name].aux & [image name].JGw ) to the directory where the image is located.  These two files are referenced when the image is added to a project,future

(Optional) Export image:
  •  From the Georeferencing menu, choose Rectify to bring up the Save As dialog

  • Change the Output Location (choose a folder or workspace), and change the name of the image if necessary.  The remaining parameters can be left with the default settings.  Click Save to continue.

  • Use the Add Data button again to add the new image to the project, or distribute as necessary

Remove null values:
After adding the image, you may notice a black box surrounding the image.  This is simply the blank space left when the new image was created from an image that was rotated slightly.  These null values have the value of 0 in the dataset and can be easily removed:
  • Right click on the image layer in the table of contents pane and choose Properties (or double click on the layer)
  • Navigate to the Symbology tab
  • Place a check next to Display Background Value setting.  Ensure that 0 is the denoted value, and that the color selector is set to No Color.  Choose Apply or OK to continue

    Removing null values from the layer

    Several georeferenced images

    One problem remains.  There are still some black outlines on the edges of these images.  Those areas are inherited from the original raw images.  These can be handled in two ways;
    1. The images can be cropped from the original JPEG files before they are georeferenced to remove the outlines.  Be sure to make copies of the original images before any editing is applied.
    2. Manipulate the geographic extent of each layer:
      • Open the layer properties for an image
      • Navigate to the Extent tab
      • Change the "Set the extent to" option to "a custom extent entered below"
      • Increase (Left & Bottom) or decrease (Top & Right) the Visible Extent values by small intervals and click Apply to view the results.

        * Reset the values if necessary by changing the "Set the extent to" option to "the default extent of this layer"

      Several georeferenced images with altered geographic extents

      If this is still not suitable, you may need to pre-process the image with some other graphics software.

      More information:

      Saturday, December 19, 2009

      Quick Zoom Tools


      Download the icons & code package:
      Custom Zoom Tools.zip

      The Bookmarks feature in ArcMap is great for navigating to a saved view, composed of a specific location and scale in a mapping project, however I'm working on a project where I want to zoom to a predefined map scale (1:5,000, 1:30,000, or 1:100,000), but I do not want to change the location.  In this case, Bookmarks are not the answer, so I built three buttons that change the Map Scale with a single click.

      Having this single click option saves up to a couple seconds of looking for an appropriate scale each time a button is used instead of scrolling, switching to the Zoom In/Out tools, or typing a scale unit manually.  It would be much faster (especially over the time span of an editing project) to use "map scale bookmarks" to automatically zoom to a predefined level.

      Three specific scales are chosen to represent three general views:
      • 1:5,000 is a decent large-scale to use for detailed neighborhood-level observations and to zoom in close enough to get a good look at braided stream segments
      • 1:30,000 is an effective medium-scale to use for viewing larger areas, while the user is still able to distinguish smaller anomalies in a coverage or in imagery
      • 1:100,000 offers a much larger visible area.  For projects that stretch over wide areas, this map scale offers a quick step back to pan across the city/county, etc.
      Remember, in cartography "large-scale" refers to larger quotients which are less than, but approach the one.  So as the denominator decreases, scale increases:
      • 1:5,000 = "One-to-five thousand" = 1/5,000 = "One divided by five thousand" = 0.0002
      • Similarily, 1:30,000 = 0.00003
      • 0.0002 > 0.00003, thus 1:5,000 is a larger scale than 1:30,000
      • Further, 1:1 = 1.0, and 1:2 = 0.5, thus 1:1: is larger than 1:2

      Installation:
      • Download and unzip the installation package, containing three bitmap icons, and a text file containing the code: Custom Zoom Tools.zip
      • Move the three bitmap files to C:\Program Files\ArcGIS\Bin\Icons or C:\arcgis\Bin\Icons (depending on your installation)
      • Open the text file Custom Zoom Tools Code.txt. Select All and Copy the text.
      • Open ArcMap and load either a saved project or a blank document
      • From the Tools menu, choose Customize.  
      • Navigate to the bottom of the Categories list and select
        [ UIControls ]
      • Make sure that the Save In menu at the bottom left of the Customize dialog is set to Normal.mxt
      • Press the New UIControl button and Create a UIButtonControl.  Repeat this two more times so the Commands list has three new UIButtonControls

        • Slow double click on each of the new button controls in the Commands list to rename them Zoom5k, Zoom10k, and Zoom100k.  The names will automatically change to Normal.Zoom5k, etc. when finished.  The names of these are important and must match exactally to work with the code.
        • Drag these three new button controls onto a desired toolbar (I put mine next to the Map Scale box)
        • With the Customize dialog still open, right click on each button and navigate to Change Button Image :: Browse.  Choose the appropriate icon ("_Zoom5k" etc.) for each button
        • Close the Customize dialog
        Now just paste the code in the correct spot to finish:
        • Open the Visual Basic Editor by pressing Alt + F11, or by navigating to Tools :: Macros :: Visual Basic Editor
        • In the Project Explorer pane, expand "Normal (Normal.mxt)," and "ArcMap Objects" and double click on ThisDocument.

        • A window will open named "Normal.mxt - ThisDocument (Code)."   Scroll to the bottom of this text, add a few lines by hitting enter a few times, and paste all of the code from the text file included in the download above
        • Save this document of code, close the Visual Basic Editor and test the buttons.

        The Code:
        In the following example a few elements are prepared to change the map scale, the map scale is set to 1:5000 (pMap.MapScale = 5000), and the map is refreshed so the new map scale will be visible to the user:

        Private Sub Zoom5k_Click()
        'Change the scale of the current view to 1:5,000

        Dim pMxDocument As IMxDocument
        Dim pMaps As IMaps
        Dim
        pMap As IMap 
        Set pMxDocument = ThisDocument
        Set pMaps = pMxDocument.Maps
        Set pMap = pMxDocument.FocusMap
        pMap.DistanceUnits = esriUnits.esriInches

        pMap.MapScale = 5000

        pMxDocument.ActiveView.Refresh 

        End Sub

        Monday, February 23, 2009

        The Velociraptor Projection, AKA the "Raptogram"

        Raptogram Projection

        The Raptographic Combined Hyperpseudocylindriconic Projection has a false easting and northing are applied to adjust the planimetric origin to be located 120 miles (190km) off the western coast of Costa Rica, over the raptor pit on Isla Nublar. This is an appropriate projection for the shallow southeastern portion of the Cocos tectonic plate; the bathymetry of which looks very much like the profile of a calculating and hungry velociraptor (Search Google Maps for the coordinates 5.534001, -87.065021 / see map inset below).

        This projection minimizes distortion and preserves distance along each parallel, however both distance and direction are significantly skewed beyond its boundaries suggesting that velociraptors exhibit an advanced sense of geographic comprehension, however they are largely unconcerned with the world beyond their own... for now.

        [Bathymetry appears to resemble a hidden raptor: View Larger Map]