[GRASSLIST:5223] Re: v.in.ogr advice needed
Tom Russo
russo at bogodyn.org
Wed Dec 22 20:17:46 EST 2004
On Thu, Dec 23, 2004 at 12:27:50PM +1300, we recorded a bogon-computron collision of the <b.wood at niwa.co.nz> flavor, containing:
>
>
> On Wed, 22 Dec 2004, Kirk R. Wythers wrote:
>
> > I have some shape files that I want to import into 57 and need some
> > v.in.ogr usage advice. The structure of the directory with the shape
> > files is thus:
>
> > So I tried importing into a new location thus:
> >
>
> I got the same error message when importing some lat/long shapefiles
> despite the shapefiles lying within the GRASS region & the GRASS location
> being lat/long.
>
> I used the -o flag (via the gui) and it worked fine. I overlaid the GRASS
> version of the data with the original shapefile in QGIS & they overlaid
> fine, so I'm assuming the error message about projection mismatches is not
> always correct (at least in this case).
Shapefiles do not have any way of storing the projection/datum information.
This is a deficiency of the shapefile format.
Some sets of shapefiles come with an auxilliary ".prj" file that v.in.ogr
can read to check the projection, but without that file it is impossible
for ogr to tell what projection is in use by the files. So in this case
unless v.in.ogr is given -o it assumes there is a projection mismatch.
Unfortunately .prj files are not part of the shapefile standard and different
programs produce and expect different contents. Output of Global Mapper, for
instance, has a format that is completely useless to OGR, and vice-versa.
If you are absolutely certain that the shapefiles are in the same projection
and datum as your GRASS area, then -o should work.
If you know for certain that your shapefiles are in UTM zone 15N with
NAD83 datum, then you can also create a .prj file for each shapefile that
reflects that. The format is a bit arcane, but the following information
(edited to be on one line) in the .prj file would take care of it.
---- pull the following lines into an editor and remove line breaks-----
PROJCS["NAD83 / UTM zone 15N",
GEOGCS["NAD83",DATUM["North_American_Datum_1983",
SPHEROID["GRS 1980",6378137,298.257222101]],
PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",-93],PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],PARAMETER["false_northing",0],
UNIT["metre",1]]
-------end of .prj information
If you put this in a .prj file with the same basename as your shapefiles
v.in.ogr will recognize that it's in the same projection as your grass location.
Heaven help you if your shapefiles are not in fact in UTM zone 15/NAD83
(EPSG:26915) and you do this --- garbage will result.
Once you have .prj files for your shapefiles, you can not only use v.in.ogr
to import them into GRASS databases with the same projection and datum, but
you can use "ogr2ogr" that comes with GDAL to translate them to different
projections and data.
--
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 grass-user
mailing list