Difference between revisions of "UbiComp:GIS"

From PublicWiki
Jump to: navigation, search
(Other Links)
Line 5: Line 5:
 
If you are looking for free GIS software, check out Grass (http://grass.itc.it/), which has a nice Mac OS Version (http://wwwamb.bologna.enea.it/forgrass/).  With just Tutorial document included with Grass, I was abled to import SHP files of bus stops from King County GIS and output CSV files of relevant data in just an hour with no previous GIS software experience.
 
If you are looking for free GIS software, check out Grass (http://grass.itc.it/), which has a nice Mac OS Version (http://wwwamb.bologna.enea.it/forgrass/).  With just Tutorial document included with Grass, I was abled to import SHP files of bus stops from King County GIS and output CSV files of relevant data in just an hour with no previous GIS software experience.
  
== State Plane Projections ==
+
== Coordinate Projections ==
 +
 
 +
While you can work directly with raw latitude and longitude readings, it's useful to project the coordinates into another coordinate system that easier to work with.
 +
 
 +
=== State Plane Projections ===
  
 
If you work with any kind of data from municipal GIS systems, it's probably using a coordinate system called State Plane Coordinate System (SPCS).  Without getting into too much detail (for that, check out MetroKC GIS [http://www.metrokc.gov/gis/kb/Content/DNRP_FAQ.htm#D4] and [http://www.metrokc.gov/gis/kb/Content/StatePlane.htm]), I'll say that SPCS is a series of coordinate systems designed to accurately map the not-flat world into flat maps here in the US.  We're in the WASHINGTON NORTH ZONE projection ourselves.  Read the links to find out more, but generally speaking, data from MetroKC GIS is typically in the Washington North SPCS based on Datum83 with HPGN (High Precision GPS Network) adjustments for the Washington-Oregon region, with units of feet.
 
If you work with any kind of data from municipal GIS systems, it's probably using a coordinate system called State Plane Coordinate System (SPCS).  Without getting into too much detail (for that, check out MetroKC GIS [http://www.metrokc.gov/gis/kb/Content/DNRP_FAQ.htm#D4] and [http://www.metrokc.gov/gis/kb/Content/StatePlane.htm]), I'll say that SPCS is a series of coordinate systems designed to accurately map the not-flat world into flat maps here in the US.  We're in the WASHINGTON NORTH ZONE projection ourselves.  Read the links to find out more, but generally speaking, data from MetroKC GIS is typically in the Washington North SPCS based on Datum83 with HPGN (High Precision GPS Network) adjustments for the Washington-Oregon region, with units of feet.
  
 
The big question, of course, is how does one convert to another coordinate system (GPS for example)?  If you are using actual GIS software, it will most likely have support for these conversions.  However, if you just have a data file with State Plane coordinate points, we need a conversion library of our own.
 
The big question, of course, is how does one convert to another coordinate system (GPS for example)?  If you are using actual GIS software, it will most likely have support for these conversions.  However, if you just have a data file with State Plane coordinate points, we need a conversion library of our own.
 +
 +
=== UTM ===
 +
 +
Might be better than SPCS because you can use it all over the world, not just the United States.  Hopefully accurate enough for most applications.
  
 
=== Using Proj at the Commandline ===
 
=== Using Proj at the Commandline ===
  
An open source solution is Proj ( http://www.remotesensing.org/proj ), which is a C library with Java bindings for doing projection conversions. From the <tt>proj</tt> documentation, we find the SPCS zone code for Washington North using Datum 83 is '<tt>4601</tt>'.  The following command will convert from an SPCS 'x y' coordinate in US feet to a lat-long coordinate.  Specifically, we convert the location of the UW Campus Hub Bus Station
+
An open source solution is Proj ( http://www.remotesensing.org/proj ), which is a C library with Java bindings for doing projection conversions.
 +
 
 +
==== SPCS Example ====
 +
 
 +
From the <tt>proj</tt> documentation, we find the SPCS zone code for Washington North using Datum 83 is '<tt>4601</tt>'.  The following command will convert from an SPCS 'x y' coordinate in US feet to a lat-long coordinate.  Specifically, we convert the location of the UW Campus Hub Bus Station
  
 
     % echo '1277730 242239' | proj -I +init=nad83:4601 +units=us-ft -f '%.8f'
 
     % echo '1277730 242239' | proj -I +init=nad83:4601 +units=us-ft -f '%.8f'
Line 26: Line 38:
 
*<tt>+units=us-ft</tt> : the input is in US feet
 
*<tt>+units=us-ft</tt> : the input is in US feet
 
*<tt>-f '%.8f'</tt> : output with eight decimals of precision
 
*<tt>-f '%.8f'</tt> : output with eight decimals of precision
 +
 +
==== UTM Example ====
 +
 +
You need to know your UTM zone to perform a projection.  You can use the Matlab 'utmzone' function for determinig which UTM zone a set of lat-lon coordinates are located.  Our HUB data point is in zone 10T.
 +
    % echo "-122.30502529  47.65458077" | proj +proj=utm +zone=10T +datum=NAD83
 +
    552186.99      5278143.40
  
 
=== Using Proj with Java ===
 
=== Using Proj with Java ===

Revision as of 04:04, 13 March 2007

UW GIS

UW has site-wide licenses to a number of corporate GIS datasets, including King Count and City of Seattle. The data set can be accessed at http://wagda.lib.washington.edu/data/washdata.html#county with a valid UW ID.

If you are looking for free GIS software, check out Grass (http://grass.itc.it/), which has a nice Mac OS Version (http://wwwamb.bologna.enea.it/forgrass/). With just Tutorial document included with Grass, I was abled to import SHP files of bus stops from King County GIS and output CSV files of relevant data in just an hour with no previous GIS software experience.

Coordinate Projections

While you can work directly with raw latitude and longitude readings, it's useful to project the coordinates into another coordinate system that easier to work with.

State Plane Projections

If you work with any kind of data from municipal GIS systems, it's probably using a coordinate system called State Plane Coordinate System (SPCS). Without getting into too much detail (for that, check out MetroKC GIS [1] and [2]), I'll say that SPCS is a series of coordinate systems designed to accurately map the not-flat world into flat maps here in the US. We're in the WASHINGTON NORTH ZONE projection ourselves. Read the links to find out more, but generally speaking, data from MetroKC GIS is typically in the Washington North SPCS based on Datum83 with HPGN (High Precision GPS Network) adjustments for the Washington-Oregon region, with units of feet.

The big question, of course, is how does one convert to another coordinate system (GPS for example)? If you are using actual GIS software, it will most likely have support for these conversions. However, if you just have a data file with State Plane coordinate points, we need a conversion library of our own.

UTM

Might be better than SPCS because you can use it all over the world, not just the United States. Hopefully accurate enough for most applications.

Using Proj at the Commandline

An open source solution is Proj ( http://www.remotesensing.org/proj ), which is a C library with Java bindings for doing projection conversions.

SPCS Example

From the proj documentation, we find the SPCS zone code for Washington North using Datum 83 is '4601'. The following command will convert from an SPCS 'x y' coordinate in US feet to a lat-long coordinate. Specifically, we convert the location of the UW Campus Hub Bus Station

   % echo '1277730 242239' | proj -I +init=nad83:4601 +units=us-ft -f '%.8f'
   -122.30502529   47.65458077

Remember that since we are converting from (x,y) coordinates, the results are (x,y) as well (longitude,latitude).

What do all those options mean?

  • -I : we are doing an inverse projection
  • +init=nad83:4601 : SPCS conversion for Washington North and Datum83
  • +units=us-ft : the input is in US feet
  • -f '%.8f' : output with eight decimals of precision

UTM Example

You need to know your UTM zone to perform a projection. You can use the Matlab 'utmzone' function for determinig which UTM zone a set of lat-lon coordinates are located. Our HUB data point is in zone 10T.

   % echo "-122.30502529   47.65458077" | proj +proj=utm +zone=10T +datum=NAD83
   552186.99       5278143.40

Using Proj with Java

We can perform the same conversion using Proj's Java bindings. Their programmatic interface is a little clunky. Specifically, they only provide public methods that output the results of conversion to System.out. That's pretty much useless, but with a simple sub-class, we're able to get at the data we want. I'm not of the performance of this code in terms of bulk processing lots of conversion at once versus doing conversion one at a time. Your mileage may vary.

import org.proj4.Others;
import org.proj4.ProjectionData;
import org.proj4.Projections;

public class PointConverter {

    public static void main(String[] args) {
       
        int rows = 1;
       
        double[][] testCoord = new double[rows][2];
        double[] testValues = new double[rows];

        // Hey... it's the HUB again
        testCoord[0][0] = 1277730;
        testCoord[0][1] = 242239;

        // This is just the Z-coord, which we don't care about
        testValues[0] = 0;

        // create the dataset
        ProjectionData dataTP = new ProjectionData(testCoord, testValues);

        String srcProjDesc = "-I +init=nad83:4601 +units=us-ft";
        String dstProjDesc = "+proj=latlong";

        Others srcProj = new Others(srcProjDesc);
        MyLatLong dstProj = new MyLatLong(dstProjDesc);
       
        dstProj.transform( srcProj, dataTP );
       
        for( int i=0; i < dataTP.rows; i++ )
            System.out.println( "x=" + dataTP.x[i] + " y=" + dataTP.y[i] );
    }

    private static class MyLatLong extends LatLong {

        public MyLatLong(String desc) {
            super(desc);
        }
       
        public void transform( Projections source, ProjectionData data ) {
            source.prepareData(data);
            doTheTransform(source, data, data.rows, 0);
            prepareTransformedData(data);
        }
    }
}

Famous Places

The University of Washington

For GIS info specific to the UW Campus, such as coordinates of important landmarks, check out its GIS Page.

The Allen Center

For GIS info specific to the Allen Center, such as coordinates of the building, check out its GIS Page.

Other Links

Looking for maps and floorplans of campus buildings? Check out http://pelee.opb.washington.edu/pnbdb/sims2/drawings/floor_plans.cfm.

The site http://www.mapbuilder.net/ is a nice interface on top of Google Maps for determining the coordinates of locations on the map.

This site, http://mappinghacks.com/, has an interesting blog about mapping plus references for a book the guys are publishing (April 30,2005) through O'Reilly titled Mapping Hacks.