2

I have a table with small polygons that are scattered around a "continental" area (Brazil). How can I convert 1m to decimal degrees of a wgs84 reference system (longitude / latitude) depending on the position of each polygon?

Broader context: I am trying to use ST_SimplifyVW(geom, tolerance) to remove spikes from polygons (as describe here). The tolerance parameter of ST_SimplifyVW is given in terms of the SRID unit, which are decimal degrees. I would prefer to have the tolerance parameter provided in square meters because: a) is a little more intuitive; b) I would like the tolerance used to be the same regardless of the latitude of the polygons.

So ideally I would have something like:

ST_SimplifyVW(geom, f_m_to_degrees(1,geom) )

where fictitious function "f_m_to_degrees"would convert the supplied distance to degrees to the most precise projection around the location of geom.

  • You could just create a simple linestring on a projected coordinate system and then use [ST_Transform|postgis.org/docs/ST_Transform.html] to get the equivalent in degrees. Its a little round-about though, and not what you asked for. – BradHards Dec 26 '15 at 3:55
  • There isn't any valid conversion from meters to degrees, even at a point, without also having a direction, as discussed in a multitude of questions. I would recommend you project your data, at which point you can use meters for simplification. – Vince Dec 26 '15 at 13:44
2

Presumably, ST_SimplifyVW() works on planar coordinates. To convert distance_degrees to distance_meters is simple:

distance_meters = earth_radius_meters * to_radians( distance_degrees )

However, treating coordinates in distance_degrees introduces distortions:

  • zero distortion in N-S direction
  • distortion proportional to Cosine( latitude ) in E-W direction

An alternative, as suggested in comments, is to project your coordinates to a suitable local coordinate system (having relatively little distortion) then work directly in meters.

  • Tks. I suppose I could do ST_Transform to local projection in meters > ST_SimplifyVW( , 1) in meters > ST_Transform back to wgs84. Is that lossless and topology preserving? In case of Brazil, longitude ranges from -73.0 to -28.3. So the appropriate "local" projection will vary. I'm using ST_Transform(geom,utmzone(ST_Centroid(geom)) for that. – LucasMation Dec 27 '15 at 22:35
  • Doing the work in UTM will be far better than a hack to get an approximate degrees/meters ratio, do the transform for sure. – Paul Ramsey Jan 7 '16 at 18:39
  • And if using UTM, see gis.stackexchange.com/questions/93332/… for how to eliminate distortion completely. – Martin F Jan 8 '16 at 1:35

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.