[Gdal-dev] Python/OGR SHAPE creation: prj file missing

Matthew Perry perrygeo at gmail.com
Wed May 31 16:20:50 EDT 2006


Markus,

  I usually cheat and just copy and existing .prj from a dataset with
the same projection. But it can be accomplished other ways as well.

If it's just an EPSG code, there the epsg_tr.py utility:
  epsg_tr.py -wkt 4326 > ${shapefile_prefix}.prj

Or if you want to do it within a python script:

srs = osr.SpatialReference()
srs.ImportFromProj4(.....)
## Or for EPSG codes
srs.ImportFromEPSG(int(....))
prj = srs.ExportToWkt()
## write the prj string to the appropriate file

- Matt
~

On 5/31/06, Markus Neteler <neteler at itc.it> wrote:
> Hi,
>
> I was writing a simple Python script to generate a
> SHAPE file following
>  http://www.perrygeo.net/wordpress/?p=4
> (thanks, Perry!).
>
> The SHAPE related files are created, but the .prj file not.
> How to enable that?
>
> thanks
>
>  Markus
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev
>


-- 
Matt Perry
perrygeo at gmail.com
http://www.perrygeo.net



More information about the Gdal-dev mailing list