The FREE Rosetta Stone of GIS Data Formats

9 04 2007

Could DNR Garmin be the Rosetta Stone of GIS Data?

It will now read from and/or save to the following file formats:

  • Shapefiles
  • ESRI File-based Geodatabase (9.2 only & only if you have it installed on your system. It apparently uses ArcObjects)
  • KML
  • GPX
  • Text files (comma or semi-colon delimited)
  • DBF

 

The Save As file options (I don’t have ArcGIS 9.2 installed on this computer so the Geodatabase option doesn’t show up).

In addition to saving as & reading from files, it will also read from & save directly into ArcMap or Google Earth.

A new version (5.2 beta) was released on March 12, 2007, with several new & important features. This program was already on my “Must Have” list for anyone working with GPS units. It is invaluble for the field work we do at Plateau Land & Wildlife.

Another great feature that it has but only some of us can use is the Image Hotlink/Geocode feature. This works essentially the same as GPicSync (a Google Code project). But DNR Garmin has been doing it for several years now.

This feature works based on the time stamps of your waypoints or tracks and the time stamp of your photos. It can automatically calculate an offset if your clocks aren’t syncronized.

Notice the “Project and Unproject Coordinates” menu items above. The software uses the Proj.4 projection libary to allow reprojection into a vast array of coordinate systems & datums very rapidly.

I’m fairly certian that you could use the libaries used by this program to make a utility that worked with any and all attributes included in your data rather than just the GPS centric fields that this works with by default. To be fair, though if you have some standard attributes, you can cutomize the fields for waypoints, tracks, routes, and real-time data to include whatever fields you want.
Update – Price for all of this : Free

I’m sure you can think of plenty of innovative ways to use this software but let me share an example with you.

As I’ve posted about before we do a lot of bird surveys in the spring. Many of these are done by sub-contractors who don’t have access to a GIS system. Let’s say we have a new client for whom we have never done a survey before. We send the sub-contractor a shapefile of the client property. She then uses DNR Garmin to convert that shapefile directly into KML & into her Google Earth My Places file. She opens up GE & there the property is with aerial photo, roads, & elevation. She adds placemarks for each of the proposed survey stations which she picks based on the info visible in GE. If she wants to colaborate with the biologist familar with the property they can easily share the info to each other. Then she opens DNR Garmin, loads those placemarks directly from GE to her GPS unit. Gets driving directions from her house to the client property through GE and goes and does the survey. If we wanted her to, she could send us back a shapefile of the census stations by saving the actual station locations from her GPS unit into a shapefile via DNR Garmin.





Comparing Mashup Platforms Using JSON & MySQL – Part 2 – Process JSON

30 03 2007

Technologies Used: PHP 5, MySQL 4.1.2, JavaScript, JSON

Software Used: PHP Designer, Aptana, Firebug, Firefox

There are a wide variety of ways to handle JSON that is returned from a server. One of these methods is to provide a callback function pass it to the JSON emiting webservice via REST. When used with static or dynamic script tags, you are no longer restricted to Cross Site Scripting (XSS) limits requireing that the source be on the same server as your webpage. The XSS limit seems particularly ill-suited for mash-ups. The callback function method is what I have choosen for my examples. You will also see a static script tag for these examples. That is to simplify them and make them easier to read. The general preference is to use dynamic script tags rather than static ones.

Actual JSON string returned:

handleJSON({“Observations”:[{"Station":{"number":"1","lat":"29.5762","lon":"-98.7041","total_sp":"9","Species":[{"common":"Mourning Dove","number":"1","code":"MODO","scientific":"Zenaida macroura"},{"common":"Eastern Phoebe","number":"1","code":"EAPH","scientific":"Sayornis phoebe"},{"common":"Carolina Chickadee","number":"1","code":"CACH","scientific":"Poecile carolinensis"},{"common":"Black-crested Titmouse","number":"3","code":"BCTI","scientific":"Baeolophus atricristatus"},{"common":"Carolina Wren","number":"1","code":"CARW","scientific":"Thryothorus ludovicianus"},{"common":"Bewick's Wren","number":"2","code":"BEWR","scientific":"Thryomanes bewickii"},{"common":"Rufous-crowned Sparrow","number":"1","code":"RCSP","scientific":"Aimophila ruficeps"},{"common":"Northern Cardinal","number":"3","code":"NOCA","scientific":"Cardinalis cardinalis"},{"common":"Brown-headed Cowbird","number":"1","code":"BHCO","scientific":"Molothrus ater"}]}},{“Station”:{“number”:”2″,”lat”:”29.574″,”lon”:”-98.7036″,”total_sp”:”5″,”Species”:[{"common":"Black-crested Titmouse","number":"1","code":"BCTI","scientific":"Baeolophus atricristatus"},{"common":"Carolina Wren","number":"1","code":"CARW","scientific":"Thryothorus ludovicianus"},{"common":"Ruby-crowned Kinglet","number":"1","code":"RCKI","scientific":"Regulus calendula"},{"common":"Northern Cardinal","number":"1","code":"NOCA","scientific":"Cardinalis cardinalis"},{"common":"Brown-headed Cowbird","number":"1","code":"BHCO","scientific":"Molothrus ater"}]}}]});

It is not very human readable, but it is highly machine readable.

Below is an extremely simple example of handling JSON and doing something with it.

<html>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1″ />
<title>Simple JSON Handling</title>

<script type=”text/javascript” charset=”utf-8″>
function showCoords(jsd){
var lat = jsd.Observations[0].Station.lat;
var lon = jsd.Observations[0].Station.lon;
var msg = ‘Lat:’ + lat + ‘, Lon:’ + lon;
alert(msg);
}
</script>
</head>
<body>
<script src=http://www.plateauwildlife.com/bbc-mgmt/getstations.php?action=getdata&cid=2&year=2006&func=showCoords type=”text/javascript” charset=”utf-8″></script>
</body>
</html>


See It In Action

The above example is not particulalry usefull for anything other than demostration purposes. We want to actually DO something with our JSON to move us closer to creating the actual mashup. The number thing which I intially strugled with when using JSON & callback functions was that you MUST define the callback function BEFORE your dynamic or static script tag.

Google Maps, Google Earth, Yahoo Maps, and Virtual Earth all take HTML for the contents of the info window when you rollover or click on a point.

ArcWeb Explorer (AWX), however doesn’t take HTML as info window content. AWX does take styled text, videos, picture, audio, & swf for info window content. To this end, if you want to embed rich non-HTML content, AWX allows for some extremelly interesting content to be blended together and presented with great ease. The documentation for text styling is lacking, so creating simple content is actually more dificult in this platform than the others.

I’ve created a javascript file which we can reference in any of the HTML docs that actually embed the mashup.

This file contains

  1. The main callback function
  2. A function which builds an array of HTML tables containing the formated results from each station
  3. A function which builds an array of jscript strings containg the weakly formated results from each station

See The HTML Builder In Action

    //A global variable to assign the parsed JSON to

var jsobj;

 

//Main Callback handler.

//simple assignment to a global variable allows me to reuse and pass

//around the object without any server trips

function handleJSON(reply){

    jsobj=reply;

}

 

    function buildHTML(Observations){

    var info_win = new Array();

    // Build a table element with Station number & total species observed

    for(var i=0;i<Observations.length;i++){

        str = ‘<table border=”1″><tbody><tr class=”station”>’;

        str += ‘<td colspan=”2″>Station ‘+ Observations[i].Station.number + ‘</td></tr>’;

        str += ‘<tr class=”sta_total”><td colspan=”2″>Total Species – ‘ + Observations[i].Station.total_sp + ‘</td></tr>’;

       str += ‘<tr class=”obs_header”><td>Species</td><td>Number</td></tr>’;

        var details = “”;

        var arr = new Array();

        // assign each Species array to a local variable to reduce typing & increase readibility

        //build an string of <tr> elements containing the details of species observed

        arr = Observations[i].Station.Species;

            for (var y=0;y<arr.length;y++){

            details+=‘<tr class=”obs_detail”><td><a href=”http://www.google.com/search?q=%22′;

            details += arr[y].scientific.replace(/\s/,“+”);

            details += ‘%22″>’ + arr[y].common + ‘ (‘ + arr[y].code + ‘)</a></td>’;

            details += ‘<td>’ + arr[y].number + ‘</td></tr>’;

            }

        str +=    details;

        str += ‘</table></tr></tbody></table>’;

        //add table element to array of table element html strings

        info_win[i]=str;

    }

return info_win;

}

 

function buildAWXtxt(Observations){

        var info_win = new Array();

    // Build a formated text list for each Station number & total species observed

    for(var i=0;i<Observations.length;i++){

        str = ‘Station ‘ + Observations[i].Station.number + ‘\n’;

        str += ‘Total Species – ‘ + Observations[i].Station.total_sp + ‘\n’;

       str += ‘Species          Number’;

        var details = new Array();

        // assign each Species array to a local variable to reduce typing & increase readibility

        //build an array formatted text data elements containing the details of species observed

        //using this convention, we can assign a url property to each species line

        //through .data{elements[]} in the properties for each marker

        arr = Observations[i].Station.Species;

            for (var y=0;y<arr.length;y++){

            details[y] = arr[y].common + ‘ (‘ + arr[y].code + ‘) – ‘ + arr[y].number + ‘\n’;

            }

        var obs_info = new Array([str,details]);

        //

        //add table element to array of table element html strings

        info_win[i]=obs_info;

    }

return info_win;

}

 

Previous Parts

1. Emit JSON

 

Next Parts

3. Arcweb Explorer Mashup

4. Yahoo Maps Mashup

5. Virtual Earth Mashup

6. Google Maps Mashup





Deer Browse, Birds Sing, & I write no code

6 05 2006

Bewick's Wren & Axis Deer

For the last 2 weeks in April, I've been doing deer & bird surveys. I always look forward to them each year. It's great to out there and get to see/hear interesting wildlife. We do a series of daylight cruise surveys of exotic & native deer for density & composition counts on a very large ranch in the western hill country. We start them at dawn and they last 3 hours. I drive from San Antonio to be there in the mornings so it makes for a VERY long day when you work till 6pm upon your return. The bird surveys are also in the mornings but they are local and don't take nearly as long.

I've been looking at the Atlas demo video Scott G. did and plan on using that in my next ASP.NET app. These past weeks I definitely fulfilled the "Write less code" item on Scott's ToDo list, I wrote NO code. Too busy just keeping things running when I get back from surveys and not enough time to do the interesting app development work. I am transitioning the reporting of these survey results to database systems instead of the old individual excel file system. I actually already transferred all the data reporting for the Bird surveys over to a MySql / PHP based web system as discussed in my last post.

The technique we use for the Deer surveys is called Distance Sampling. The data collection requires a GPS point at your 1st sight of the animal(s), Distance to animal(s), Bearing to animal(s), and then information on the animals themselves. We record the points & track in our GPS units and then download them using DNRGarmin and save them as shapefiles for processing using Hath's Analysis Tools for ArcGIS. The results are analyzed in DISTANCE. We also manually record the coordinates for each waypoint and all the other info. As you can imagine writing all the info and then having someone enter it all in, can be rather tedious.

I'm planning on writing a data collection interface for use with our Palms so we can eliminate that step. It should in theory be quite easy, but I've never written anything for Palm OS before. My idea is to output an XML file based on the data entered, sync the Palms with the desktop upon return, and then use the .NET XML to DB tools to quickly upload and combine all the separate XML file data. If anyone has tried this before or has some good suggestion or pointers on writing for Palm OS, I'd love to hear it.