[Xastir] Datum conversions

Tom Russo russo at bogodyn.org
Sun Dec 19 16:11:28 EST 2004


On Sun, Dec 19, 2004 at 01:51:25PM -0700, we recorded a bogon-computron collision of the <jewen at shaw.ca> flavor, containing:
> > > After a little head scratching, I finally figured out that 
> > the datum 
> > > might be wrong. shpinfo show me file bounds of 1369668.166, 
> > 923382.659 
> > > / 1386313.311, 934944.981
> > 
> > What you really mean is that they're in some projection other 
> > than lat/lon.
> 
> Umm.... I really don't know now! I did some reading about datum vs.
> projection, and now I'm more confused than ever.
> http://biology.usgs.gov/geotech/documents/datum.html

If you want to learn about this stuff, I highly recommend the "Geographer's
Craft" web site.  http://www.colorado.edu/geography/gcraft/contents.html

Basically (and in lay terms, coz I'm a layman unlike Gerry), projection is a 
mathematical operation that maps spherical oordinates (lat/lon) into some planarcoordinate system for mapping.

Datum is a set of information describing the shape of the earth.  

You can't do projection without datum, and the results you get depend on
what datum you use.

> Where to lat and long enter into this mess? Is that part of the projection?
> UTM uses easting and northing, and UTM is a projection. Can UTM be projected
> onto different datums?

Heh.  UTM is a projection that maps the ellipsoidal earth onto a cylinder
that is tangent to the earth along a line of longitude.  There is a 
mathematical relationship between UTM coordinates and lat/lon coordinates.

It is possible to go from one type of coordinates (projection) in one datum to 
another type of coordinates in a different datum.  But you have to know 
what you're starting with.

The program "cs2cs" that comes with the Proj4 library (which you have if
you installed geotiff support according to INSTALL) will do this type of
conversion on ascii files of coordinates (or terminal input).

For example:
cs2cs +proj=utm +zone=13 +datum=NAD27 +to +proj=latlong +datum=WGS84
will translate easting/northing coordinates in UTM projection in zone 13 
(108deg W to 102degW) with NAD27 datum into lat/lon WGS84 datum (what Xastir
expects).

I wrote a crude hack on cs2cs that does exactly the same operation on 
shapefiles with the same command line parameters.  It's downloadable from
the same place as my other shapefile tools, 
http://www.swcp.com/~russo/shape_web

ogr2ogr is more powerful and can read .prj files (when they're in the right
format, as some are not) so you don't have to tell what the source projection
and datum are.

> > No, one of the problems with shapefiles is they have no way 
> > of storing the projection and datum information.  The only 
> > way to get this information is through auxiliary files, 
> > called "metadata".
> 
> According to the webpage referenced above:
> 
> >Other software packages such as ERDAS Imagine,
> >PCI, ENVI, or GRASS also allow the user to query
> >the dataset to determine the datum/projection.
> 
> DO they mean that the software queries the dataset by looking at the .prj
> file, or by actually looking at the data in the .shp/.shx/.dbf files?

They use file formats other than shapefile that contains the datum and 
projection information.  Shapefiles contain only coordinates and topological 
information, and require additional data files (not part of the shapefile
standard) to carry that information.

> > If you have a shapefile that is just one polyline, it would 
> > not be too difficult to write a small program that converts 
> > it into a file that one of the GPS upload utilities uses.  At 
> > the moment, xastir has no capability to load anything *into* 
> > a GPS through gpsman, only download stuff from one.
> 
> It looks like GPSMan would do the conversion, however it won't run on Cygwin
> from what I've read. It looks like I might be able to find Windows based
> software to do the job as well.

Nod.

> This is a good thing in another way as well. I've thought about using the
> GPS record trail function to allow me to create a pseudo map. By carefully
> selecting a limited amount of data from the shapefiles, I should be able to
> create a low detail map of my local area, and upload it to the GPS as a
> trail. By turning record trail off, my "map" will stay in memory. I would be
> able to get a better idea where my uploaded APRS waypoints are on the GPS
> map screen.
> 
> More 2 AM nights are foreseen!

Sleep is overrated.  If it weren't for the four hours between midnight and 1 am,
I'd get no work done :-).

-- 
Tom Russo    KM5VY     SAR502  DM64ux         http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://www.qsl.net/~km5vy/
 "When life gives you lemons, find someone with a paper cut."



More information about the Xastir mailing list