FlowingCode / GoogleMapsAddon

Vaadin Addon based on Google Maps Web Component
https://www.flowingcode.com/en/open-source/
Apache License 2.0
20 stars 7 forks source link

Add support for clustering with custom marker images #111

Closed JonasMelchior closed 10 months ago

JonasMelchior commented 11 months ago

It seems like clustering only works, when picking the "default" markers. If specifying a marker URL for the image, clustering doesn't seem to work ...

javier-godoy commented 11 months ago

Hello. The following example seems to work. Are your images served from the same application that uses the add-on? (if not, it may be a cross-origin issue; is any error logged in the browser?)

 GoogleMap gmaps = new GoogleMap(apiKey, null, null);
    gmaps.setMapType(MapType.ROADMAP);
    gmaps.setSizeFull();
    gmaps.setZoom(5);
    gmaps.setCenter(new LatLon(-31.636036, -60.7055271));

    gmaps.addMarker("Marker 1", new LatLon(-31.646036, -60.7055290), true, "https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png");    
    gmaps.addMarker("Marker 2", new LatLon(-31.562346, -60.6176364), true, Markers.PINK);    
    gmaps.addMarker("Marker 3", new LatLon(-31.531917, -60.8456027), true, Markers.PINK);
    gmaps.addMarker("Marker 4", new LatLon(-31.651667, -60.9555557), true, Markers.PINK);

    gmaps.addMarker("Marker 5", new LatLon(-30.997815, -65.60542944), false, Markers.BLUE);
    gmaps.addMarker("Marker 6", new LatLon(-31.298693, -66.50630836), false, Markers.BLUE);
    gmaps.addMarker("Marker 7", new LatLon(-31.878914, -66.28658178), false, Markers.BLUE);

    gmaps.addMarker("Marker 8", new LatLon(-33.138889, -65.95699194), false, Markers.GREEN);
    gmaps.addMarker("Marker 9", new LatLon(-33.322683, -65.12203100), false, Markers.GREEN);
    gmaps.addMarker("Marker 10", new LatLon(-33.652538, -65.737265381), false, Markers.GREEN);

    gmaps.enableMarkersClustering();

    add(gmaps);    

clustering

paodb commented 10 months ago

Closing as there has been no response to our comments for a while. If there is further help needed, just re-open the ticket.