Thursday, 18 May 2017

open source gis - Pure JavaScript Library for Geometry Operations


Does anyone know of a pure JavaScript library for doing geometry operations such as buffer, union, intersects, etc? I want to play with doing these operations in the browser. It looks like GeoScriptJS has some dependencies.



Answer



You could look at the OpenLayers API, particularly the Geometry classes. You can check for intersects, and have access to vertices etc. I've implemented point buffers in the past just with OpenLayers. Unions may be trickier though.


For more complex operations you may want to do the processing server-side, and pass results back in WKT or GeoJSON, both of which OpenLayers can display. See this Union tutorial for an example.


Another possible option is Spatial Query a "JQuery like Javascript library for handling spatial maths." I'm not sure how well tested it is but as the source is available you should take a look.


Update



There is now a JavaScript port of the JTS Topology Suite - https://github.com/bjornharrtell/jsts


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...