[Gdal-dev] python ogr - creating a feature in a postgis layer

Jason Gaudet jgaudet at gmail.com
Mon Apr 2 01:24:23 EDT 2007


Hello list.

I am attempting to take information from an ESRI Shapefile data source and
write it to a PostGIS data source. The data I am using is all in the same
projection, but I cannot create a new feature in the postgis layer. When I
try to:

postgisLayer.CreateFeature(newfeature)

My SRID is set to -1, where it should be set to 42102 (I am using the older
projection format, so that is what the enforce_srid_constraint for my table
is expecting.)  I have searched the net and have not yet found a way to
change the SRID attribute in the geometry.  So far I've tried this:

newspatial = osr.SpatialReference()
newspatial.ImportFromEPSG(42102)
newfeatureGeometry.AssignSpatialReference(newspatial)

But when I try to write to the postgis db it still shows the SRID as being
-1. I'm a GIS newbie, so I'm still a little vague about what *all* of the
data structures represent, but I've been spinning my wheels on this for a
week now. I'd be very grateful for any help.

Thanks,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070401/d7545c5d/attachment.html


More information about the Gdal-dev mailing list