[Gdal-dev] Re: OGR C API question
sholl at gmx.net
Tue Apr 6 00:47:24 EDT 2004
Hello Frank, Etienne,
On Mon, 29 Mar 2004 17:03:17 -0500 Frank Warmerdam <warmerdam at pobox.com>
> Etienne Dube wrote:
> > Hi Stephan,
> > You have to make sure the SRID reference from the layer table is
> > present in the spatial_ref_sys table. Otherwise it seems that OGR is
> > unable to apply the spatial filter. First, if you haven't actually
> > installed the PostGIS functions in your database, do it:
> > createlang -U postgres plpgsql <dbname>
> > psql postgres -d <dbname> -f postgis.sql
> > Then, you can use ogr2ogr to fill in the rows from a shapefile:
> > ogr2ogr -f "PostgreSQL" -s_srs
> > 'GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPH
> > EROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT
> > ["Degree",0.0174532925199433]]' "PG:dbname=<dbname>
> > user=<username>" SHAPEFILE.SHP
> > (Of course, you have to replace <dbname> and <username> by the
> > correct values.)
> > I've found that if you don't specify the -s_srs (source spatial ref.
> > sys.) when importing an ESRI shapefile with ogr2ogr, the SRID row in
> > spatial_ref_sys won't be created. Make sure you use the same datum
> > as the data in your shapefile.
Indeed, that is the point. After giving the correct SRID the spatial
part os pulled out of PostGIS! Many thanks to all!
btw, is there some work in progress at the mentioned improvements of the
selcting-method of the -spatial switch?
Check headers for GnuPG Key!
More information about the Gdal-dev