It is possible to add markers onto the map via a data model and then select or drag it by interacting with the map.
The marker should be an instance of
org.primefaces.model.map.Marker. Markers can be easily constructed by providing an instance of
org.primefaces.model.map.LatLng to define their position. The
longitude values could be provided to the
LatLng class as constructor parameters. Markers will be added to the data model via the
addOverlay method. This is shown in the following code:
MapModel markerModel = new DefaultMapModel(); markerModel.addOverlay(new Marker(new LatLng(41.073399, 29.051971), "Bosphorus")); markerModel.addOverlay(new Marker(new LatLng(41.118418, 29.134026), ...