In this post I'm going to give some more information about the GeometryVisualizer that I created recently.
The goal of the GeometryVisualizer is to be able to quickly visualize a GeoJson, WKT or ESRI JSON geometry. I created this to be able to quickly see how some ESRI JSON and WKT geometries looked like and visually verify some geometry conversion code I'm writing for my GeometryService in node.js. You can also use this to visualize the WKT or GeoJSON output of a PostGIS geometry query.
OpenLayers map initialization:
- Clear the graphics
- Parse the geometry string representation
- Create a graphic and set its symbol according to the geometry type.
- Update the extent of the map
The process of adding WKT and GeoJSON geometries was very similar.
- Remove all features
- Parse the geometry string representation with a predefined formatter (OpenLayers.Format.WKT or OpenLayers.Format.GeoJSON)
- Update the extent of the map.
This are the most interesting parts of the code. The full source code is in the GeometryVisualizer.
Any questions/remarks/improvements ? Let me know !