0

Imported the following shape file:

shp2pgsql -c -s 2262 MCGIS_Towns_Villages public.towns | pgsql -d database

Queried:

SELECT gid, name,st_astext(the_geom) as the_geom FROM towns

The multipolygon I get back is does NOT have points that are in latitude longitude types of numbers.

If I do:

 SELECT gid, name,st_askml(the_geom) as the_geom FROM towns

The data I get back has latitude and longitude type of data.

Why is this?

2

The KML Standard uses degrees Latitude/Longitude for coordinates. You cannot use any other coordinate type, such as Easting/Northing in feet.

The PostGIS function ST_AsKML(geom) has an embedded ST_Transform(geom, 4326) call within it, so that your output conforms to the KML Standard, with Lat/Lon coordinates.

If you want to use an XML format that keeps your original coordinates, consider GML.

0

That seems reasonable as EPSG:2262 is measured in feet. Either use ST_Transform to reproject your coordinates on output in the data base or use ogr2ogr to reproject the shapefile to EPSG:4326 to get a lat/lon based dataset before you use shp2pgsql for the import.

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.