[gdal-dev] How to add a OGRSpatialReference to an OGRLayer?

Tom Kazimiers 2voodoo at gmx.de
Tue Sep 30 16:55:21 EDT 2008


Hi,

unfortunately I have no experience with OGR and want to display a
SHP-File (on WinCE, but I don't think that matters). The rendering works
well, but is slow - so I will add some caching. One thing of faster
rendering is to use SetSpatialFilterRect() I guess. This works, as
written in the docs, with comparing the coorinates (they must be in the
same coorinate systeme). Sadly, my shp files do not have any
SpatialReference (I get NULL returned from OGRLayer::GetSpatialRef() ).
If I use SetSpatialFilterRect() with this shp file datasource I will get
back absolutely no features. I thought the reason for this could be the
missing spatial referenc. So I wonder how to add/change a spatial
reference (e. g. a coorinate interpretation, right?) to a layer?

I looked through the mailing list, but found nothing that helped me.

Thanks in advance,
Tom



More information about the gdal-dev mailing list