27

I have a shapefile that has geography types.

Can I convert it with a tool like shp2pgsql or is there a postgis function to do that?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Paco Valdez
  • 1,378
  • 1
  • 10
  • 15

2 Answers2

29

You can cast the geography type to geometry by appending the ::geometry

SELECT ST_Distance('LINESTRING(-122.33 47.606, 0.0 51.5)'::geometry, 'POINT(-21.96 64.15)'::geometry);
CaptDragon
  • 13,313
  • 6
  • 55
  • 96
2

shp2pgsql has a flag to import data in a geography type column:

shp2pgsql -G ....

But you can also import your data without it, by default shp2pgsql will create a geometry type.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
yjacolin
  • 85
  • 1