GadvancedMarker
Notice: This is an experimental version with support for the advanced marker API. We are proactively preparing for a potential future replacement of the current marker API. Your feedback is greatly appreciated!
Since zk-gmaps 5.0.0
Employment/Purpose
The component representing the Google Maps AdvancedMarkerElement that you can use to indicate a specific point by latitude and longitude. The advanced marker replaces the GMarker, which Google Maps APIs have deprecated. (As of February 21st, 2024 (v3.56), google.maps.Marker is deprecated.)
Migration Requirements
To use advanced markers, additional configuration is required on the associated map. Follow the official migration guide for more information.
Specify mapId
To allow for this new configuration, the GMaps component in the development branch now has a new setter: mapId
.
mapId
can be set from java, using org.zkoss.gmaps.Gmaps.setMapId(String)
or in zul with <gmaps mapId="String"/>
.
The steps necessary to obtain a mapId are:
- Register your developer account on the Google Maps developer console, with the account supporting your Google Maps API key.
- In "Map Style": Create a map style
- In "Map Management": Create a Map ID
- Associate your Map ID and your Map style
- Copy the Map ID field, and use either Java or Zul to set the map ID on your Gmaps component.
Once these steps are completed, you can add GAdvancedMarker descendants to your Gmaps map component. This can be done in Java, or in Zul.
Example
<gmaps height="500px" width="500px" mapId="your-map-id">
<gadvancedmarker lat="37.4410" lng="-122.1490"/>
</gmaps>
Supported Events
- Inherited Supported Events: ZK Component Reference/Diagrams and Reports/Gmaps/Gmarker
Supported Children
*None