Can anyone point to generic algorithm or library for buffer zones if the source data is in WGS84 degrees? The buffer width should be in meters, as buffer in degrees it generally does not make much sense.

I'm aware of popular geometry libraries like JTS, PostGIS, ESRI etc, but none of these seem to work for lat/long case. I can of course convert latlon to some cartesian projection and then use these libraries, but this is usable only in small scale, limited specific area and/or with sacrificing precision. Also for some cases you may "convert" meter distance to degree distance, but this is ugly and heavily dependent on latitude. Some libs have first algorithms for proper lat-long, e.g. PostGIS can do Haversine distance, but no Buffers.

So basically I would need a Buffer polygon which would be created using Haversine distance from given line.

Now if you really do not know such algorithm/tool, which would work without limitations (globally, with any coordinates and buffer size, giving still high mathematical precision), then you can suggest "second class" alternatives with limited input area and buffer sizes, keeping precision to <1m scale and assuming that the area is somewhere in inhabited regions (i.e. not in Antarctica or ocean), and total size is below say 500km. For most cases it would do the job also.

p.s. tools and code samples in Java would be preferred. Specific target would be a mobile app (Android) which is used for technical underground infrastructure checks (digging safety) in cities anywhere in the world. It requires high precision regardless of latitude, but in sane range (<80 deg).

  • what size are your polygons and buffers? – Ian Turton Jul 31 '18 at 13:36
  • my question here is meant for generic case - looking for the superalgorithm (like Havershine is) which would "just work" with any coordinates and buffer size - cross poles, over 180-deg line etc, with 1 million km buffer (result would be 'the earth'). But if you have good algorithm with some limitations, e.g. small buffers (0.5 - 5 km range) then please suggest, at least it should be usable for most cases. – JaakL Jul 31 '18 at 13:50
  • could you edit the question to make that clear – Ian Turton Jul 31 '18 at 14:10
  • I disagree that converting to a length- or area-preserving meter-based CRS is "ugly," "dependent on latitude," or "usable only in small scale." I do this frequently, for large and many 4326 CRS polygons, and with good speed. Your question is a good one, but if you don't find any suitable answers, it's not a terrible approach to convert, buffer, then un-convert. I will be surprised if you can do continental-scale buffering and keep precision to <1m (and I don't know why this level of precision would be necessary). – Jon Jul 31 '18 at 14:45
  • ArcObjects Java: IBufferConstructionProperties2:setUseGeodesicBuffering – mkennedy Jul 31 '18 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.