1

I am building an application where I need to build a radius n meters around a given lat, lon. the st_buffer overload that uses a geography type for the first parameter would work fine, however, I am using an ORM that does not provide the ability to cast a geom to geography.

I tried setting the SRID to 4326 but it still outputs the circle in much larger units.

Is there some calculation/formula I can use to convert n meters to whatever units the geometry type uses?

foobarbaz
  • 111
  • 1
  • 1
    which srid is your geometry in? 1. if the geom is a geometry type already you should buffer it in geometry 2. how are you not able to convert to geography? if you are using postgis you have that ability. you might need to explicitly call SQL with whatever environment you are working on – ziggy Nov 08 '19 at 16:10
  • 3
    you should not be buffering in 4326 – ziggy Nov 08 '19 at 16:10
  • my geometry is a point using st_makepoint(). I was trying with SRID 4326 but open to suggestions. I just need a cirlce n meters around a given point. – foobarbaz Nov 08 '19 at 16:27
  • so the SRID is already in 4326? what area of the world are these points in? – ziggy Nov 08 '19 at 16:33
  • mainly US and Canada – foobarbaz Nov 08 '19 at 17:42
  • find a coordinate system in meters that covers your area. bufering in 4326 will lead to strange results For geography this may not behave as expected if object is sufficiently large that it falls between two UTM zones or crosses the dateline https://postgis.net/docs/ST_Buffer.html – ziggy Nov 08 '19 at 18:34
  • 1
    https://gis.stackexchange.com/questions/275057/how-to-find-good-meter-based-projection-in-postgis – ziggy Nov 08 '19 at 18:35

0 Answers0