Thursday, 6 August 2015

postgis - shp2pgsql srid 2262 polygons NOT in geocordinates


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?



Answer



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...