1

I used this website to determine that the SRID for my shapefile is 3857. Following that information, I used the shp2pgsql utility to convert my shapefile into the sql I need to insert into PostreSQL (using PostGIS):

shp2pgsql -s 3857 /my.shp > /my.sql

The data was inserted properly into Postgres giving me a geom column of type geometry(Point, 3857), which is what I expected.

My issue is that when I run the following query to get the lat / lon value, they don't give me the proper coordinates. Here's my query:

select ST_AsText(ST_Transform(ST_SetSRID(geom, 3857), 4326)) from mytable limit 1;

The problem is that it gives me a latitude and longitude that points to a random location in India, when I know in fact that this should be pointing to a location in the United States.

It's worth noting that when I use the ogr2ogr utility to convert my shapefile to GeoJSON, it maps out all of the coordinates correctly, so the shapefile itself seems to be in proper order.

Here are some untransformed points from a basic ST_AsText query: POINT(-10683225.3808045 3373544.37856286)

  • EPSG:3857 is not utm, but Pseudo Mercator. Can you try without ST_SetSRID, because you have already set the SRID when importing. – AndreJ Feb 20 '15 at 18:28
  • Could you perhaps post a couple of the (untransformed) points? – John Powell Feb 20 '15 at 18:32
  • I've added untransformed points. I've also tried not specifying ST_SetSRID to no avail. – John Feb 20 '15 at 18:50
3

Ok, so I figured out the issue... I scanned through other shapefiles I have that are related and noticed that their SRID is set to 2278. I inputted that for the current shapefile and I'm getting the correct coordinates now. Someone probably messed it up in ArcGIS or similar beforehand. Thanks for taking a look!

  • You should mark you answer right :) – LR1234567 Feb 22 '15 at 18:45

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.