[Gdal-dev] Shapfiles and Projections

Ed McNierney ed at topozone.com
Tue Oct 9 14:22:14 EDT 2007


Kent -

Sorry - when I said that the projection information was in the .txt
file, I did not mean to imply (but I did) that it could be automatically
read from that location.  A "shapefile" is really 3 or more files -
file.shp, file.dbf, and file.shx - and you must have all three or it's
not a shapefile.  In addition, if you have file.prj containing the
projection definition then that will be read automatically - the .txt
file is not part of the shapefile suite and isn't recognized.

     - Ed


-----Original Message-----
From: gdal-dev-bounces at lists.maptools.org
[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Kent
Eschenberg
Sent: Tuesday, October 09, 2007 1:59 PM
To: gdal-dev at lists.maptools.org
Subject: Re: [Gdal-dev] Shapfiles and Projections

Thank you all for your assistance. The gdal/ogr library can read the
shapefile 
if the directory also contains the dbf and shx files that came along
with the 
shp file. Specific responses below.

  -----Original Message-----
 > gdrinfo doesn't seem to find a projection in a shapefile describiing
roads
 > (from the National Atlas). I was expecting something like what
gdalinfo
 > finds in a geotiff file. Could someone point me towards the answer?

Martin Chapman wrote:
 > Make sure there is a .prj file with the same name as the .shp file.
NTAD
 > data doesn't always come with these projection files.  If you read
the .txt
 > file with the shape file it will tell you what datum it is using.
Attached
 > is a wgs84 prj file that should work if you rename it to be the same
as your
 > .shp file.  NTAD is generally in WGS84.

Hmmm ... I didn't do that; there is no prj file but it now seems to
work.

Ed McNierney wrote:
 > Unfortunately, the concept of projections and coordinate systems in
general
 > was late in coming to the shapefile format, and many (if not most)
 > shapefiles have no projection/coordinate information with them.
 >
 > Your shapefile should have a .txt file with it (presumably
roadtrl20.txt
 > if you're using the roads layer from the National Atlas) and it will
 > contain this information:
<clip>

Yes, a txt file was supplied and it has information similar to your
example. 
However it doesn't seem to be used. I'm still developing my application
and so 
I'll find out soon enough if it is needed by hiding or not hiding the
txt file.

Frank Warmerdam wrote:
 > I assume you were using ogrinfo?
 >
 > It will report coordinate system info if it finds it.  Does your
shapefile
 > dataset include a .prj file?   If not, there is not declared
coordinate
 > system for the file.

Yes, my mistake, I am using ogrinfo. No prj file was supplied but it
seems that 
information was provided in the txt file.

Kent
Pittsburgh Supercomputing Center
_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/gdal-dev




More information about the Gdal-dev mailing list