leaflet4vaadin icon indicating copy to clipboard operation
leaflet4vaadin copied to clipboard

Marker LatLng Jackson Parser Exception

Open jimbok8 opened this issue 3 years ago • 2 comments

I have found a new problem when creating a Marker from a LatLng value of an existing Marker and adding it to a map. THis error is thrown: Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "alt" (class com.vaadin.addon.leaflet4vaadin.types.LatLng), not marked as ignorable (3 known properties: "altitude", "lng", "lat"]) at [Source: (String)"{"lat":51.463353808734574,"lng":-0.30032978947940125,"alt":0}"; line: 1, column: 61] (through reference chain: com.vaadin.addon.leaflet4vaadin.types.LatLng["alt"])

This is the code that adds the marker (getMarker() gets an existing marker from a HashMap and retrieves its LatLng value) :

String cirString = "<svg xmlns='http://www.w3.org/2000/svg' width='1000' height='1000'><circle cx='500' cy='500' r='460'  stroke='#ff00ffff' stroke-width='80' fill='none'/></svg>";
String cirIconUrl = new String("data:image/svg+xml," + cirString.replace("#", "%23"));
Icon cir = new Icon(cirIconUrl, null, null);
int size = 51;
cir.setIconSize(Point.of(size, size));
cir.setIconAnchor(Point.of(size / 2, size / 2));
cir.setPopupAnchor(Point.of(size / 2, size / 2));
cir.setTooltipAnchor(Point.of(size / 2, size / 2));

Marker m = getMarker(gs);
LatLng highlightLatLng = m.getLatLng();
highlighter = new Marker();
highlighter.setLatLng(highlightLatLng);
highlighter.setIcon(cir);
highlighter.addTo(leafletMap);
highlighter.setZIndexOffset(999);

Is this a bug? Thanks Jim

jimbok8 avatar Jan 25 '21 13:01 jimbok8