I have a number of points stored as geographies in PostGIS (version 2.0.1), and I'd like to create rather large buffers around them (with a radius of 5000+ km).

However, ST_Buffer doesn't handle this case. As the documentation warns, it doesn't work well when you cross the poles or the international dateline, which happens with this very large radius.

What can I do instead? I only have 170 points, and this is being done offline, so it doesn't have to be super fast. I'm envisioning creating smaller buffers (which work correctly), and then programmatically extending each of the corners of the resulting polygon outward to approximately the right distance from the point (probably by creating a function in pl/python or something). But it seems like there ought to be a better way.

(In case it matters, after creating these buffers I'm unioning them; my use case is to visualize parts of the earth that are not within 5000 km of these points, by filling in the areas that are within that range.)

  • possibly answered by gis.stackexchange.com/questions/10352/…
    – WolfOdrade
    Commented Jul 30, 2013 at 21:58
  • I actually consulted that question while working on this, but it didn't seem to help. My issue isn't that the circles aren't the exact right distance; it's that I can't create them at all, due to the poles / international dateline.
    – mjjohnson
    Commented Jul 30, 2013 at 22:05
  • Since ST_buffer only has that problem with geographies, theoretically you could transform(cast) everything to geometry and do all the operations that you want, and then transform back to geography when you are done. Commented Aug 5, 2013 at 18:49
  • Sadly, the geometry type is the reason for the problem (ST_Buffer does its own cast to geometry internally). I tried casting to geometry first, but it didn't help.
    – mjjohnson
    Commented Aug 5, 2013 at 19:42
  • Internally ST_Buffer(geog, N) is akin to ``` ST_Transform(ST_Buffer(ST_Transform(geog::geometry, st_bestsrid(geog)), N),4326)::geography ``` The problem is the buffer operation normally works in a projection where you can cross the date line, then you try to bring it back to a representation where you can't. Unfortunately, this isn't an answer. Commented Feb 25, 2014 at 23:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.