Closed mstahv closed 10 years ago
+1 for this. I imagine having a dependency on JTS is reasonable; I expect almost any Vaadin mapping application will already have this.
Using polygons as an example, presumably the LPolygon class would remain, but what would essentially be helper methods for translating between JTS and the leaflet world would be added, e.g. LMap.addPolygon(Polygon jtsPoly) ?
I have thought of adding methods like LPolygon.setPoints(LinearRing) as an alternative API for v-leaflets internal datatypes.
One other Java-GIS expert also told me that JTS dependency (at least via geotools) kind of de-facto standard and it is handy also for e.g. #25 so I guess that is going to appear in next version.
Yes all the Java-GIS libraries I know use JTS ... http://sis.apache.org/, WorldWind, Geotools
I could start by adding some methods to LMap - I have a concrete requirement for adding JTS Multipolygons ... See prototype: http://139.191.1.177:8080/ibis-client/#!TaxonName/2731
I need to support groups of islands which comprise e.g. a designated area.
All contributions are more than welcome!
If the feature dont's strictly belong to LMap, I'd though add it into a separate helper class. In LMap class I'd like to see JTS support in methods like setCenter and zoomToExtent. They should definitely have overloaded version with appropriate JTS data type.
Ok, I had a quick go at this. It was pretty easy to add some convenience methods to LFeatureGroup - just because this fitted well with my multi-polygon requirement.
Just let me know you want to see the API looking. I added setCenter on LMap, which is a little ugly given the two Point classes.
Great, I' can try to move these https://github.com/mstahv/vleafletexample/tree/master/src/main/java/org/peimari/vleafletexample/jtsfields in and make a new release on Friday (probably a snowstorm day).
You might find some handy from this class: https://github.com/mstahv/vleafletexample/blob/master/src/main/java/org/peimari/vleafletexample/JTSUtil.java
The big generic Geometry->LeafletLayer function seems to work OK, but I wonder if it would be better to return a LeafletLayer[], which can be directly used in variadic functions. Also will need to think about Points.
array is an option, overloading with addLayers(Collection
Changed the way geometry collections are handled a bit in https://github.com/mstahv/v-leaflet/commit/155768a926ffe4fd4c4e1e029f92eba4e59828d8
Starts to look quite good to me. I'll close this issue, but if there is still relevant API that needs "JTS version" it can of course be added.
Quite many Java with apps with geospatial features use JTS Topology Suite. It might be still worth switching to use its data types in the server side API.
Transition could be done by deprecating the old API and still support own types for a while.