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.
Best Answer
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:
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.