3

I'm trying to load a shapefile (link) into my database with shp2pgsql.

shp2pgsql -D -W UTF8 -I -s 4326 scbel01012011_gen13.shp bel | psql -d stat

no problem so far, but when I'm trying to get some informations from the table by using a coordinate I get no results. I checked the table, all data are loaded. Here my query:

SELECT * FROM bel WHERE ST_Intersects(geom,ST_SetSRID(st_makepoint(4.380286, 51.112025), 4326));

Any suggestions?

4

If you use -s 4326 you are overriding the SRS of the shapefile rather than reprojecting it. You want to use -s 31370:4326 to force the reprojection of the data. So your entire command line becomes (since you can't use -D and reproject):

shp2pgsql -W UTF8 -I -s 31370:4326 scbel01012011_gen13.shp bel | psql -d stat

and your query returns one row:

15;17;"11001A20-";11001;"A20-";"11001A20-";"11001A20-";"11001A20-";"DE KOEKOEK"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.