milgraphics
milgraphics copied to clipboard
Keep original TacticalJSON anchor points
As an experiment I'm working on a simple Leaflet layer for milgraphics. One of the things I want to render is the anchor points that define the geometry of the graphics. Here's an example:
Unfortunately, the original anchor points are not available in the GraphicsLayer
object because they are overwritten by the converted geometry:(https://github.com/spatialillusions/milgraphics/blob/master/src/graphicslayer.js#L8)
feature.graphic = new ms.Graphic(feature);
feature.geometry = feature.graphic.geometry;
Maybe you could keep the original anchor points in feature.geometry
and instead use feature.graphic.geometry
in asOpenLayers
and asCesium
? Another option is to create a copy of the anchor points and store them as an attribute on the feature object. An advantage of the current approach is that it is simple to render the converted graphic in an arbitrary GeoJson render.
I agree with you here, and it is something I have had in mind but not implemented. (The code is still sort of just me trying out stuff...)
I agree with you that it would be nice to use feature.graphic.gometry
, and I think the best way to handle an arbitrary GeoJSON renderer is to add a new method asGeoJSON
, that convets the GraphicsLayer to plain GeoJSON with or without the original geometry as a property.
Does that sound like a good idea?
👍 I like your idea. I know it is early in the development process, so sorry for rushing things :) It is fun to experiment with milgraphics.
In the future it would be nice to have asLeafLet as well, but for now the main focus is asOpenLayers and to create output for more of the sidc codes.
On 12 May 2017, at 19:45, Kjell Magne Fauske [email protected] wrote:
👍 I like your idea. I know it is early in the development process, so sorry for rushing things :) It is fun to experiment with milgraphics.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.