-
Notifications
You must be signed in to change notification settings - Fork 914
KmlOverlay
###Add a KmlOverlay
map.addKmlOverlay()
adds geographic markup onto the map from a KML file.
You can specify the file using one of the following protocols: http
, https
, file
, cdvfile
or the file absolute path.
Only Android, also accepts file:///android_asset/
.
The added overlays are clickable.
PhoneGap-GoogleMaps-Plugin can parse only Polyline, Polygon, and Markers currently
Field Name | Type | Description |
---|---|---|
url | String | The url of the kml file (file path or network url) |
preserveViewport | Boolean | Set true if prevent the camera animation after overlays are added. (Default: false) |
animation | Boolean | Set false if you want to change the camera view without animation. (Default: true) |
map.addKmlOverlay({
'url': "www/polygon.kml"
}, function(kmlOverlay) {
kmlOverlay.on(plugin.google.maps.event.OVERLAY_CLICK, function(overlay, latLng) {
if (overlay.type == "Polygon") {
overlay.setFillColor("red");
}
if (overlay.type == "Polyline") {
overlay.setColor("blue");
}
if (overlay.type == "Marker") {
overlay.showInfoWindow();
}
});
});
Method | Return value | Description |
---|---|---|
getMap() | Map | Return the map instance. |
remove() | void | Remove the kml overlay. |
getOverlays() | Array.<Polyline | Polygon |
If you get an error, feel free to ask me on the official community or the issue list.
New version 2.0-beta2 is available.
The cordova-googlemaps-plugin v2.0 has more faster, more features.
https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/tree/master/v2.0.0/README.md
New versions will be announced through the official community. Stay tune!
Feel free to ask me on the issues tracker.
Or on the official community is also welcome!
New version 2.0-beta2 is available.
The cordova-googlemaps-plugin v2.0 has more faster, more features.
https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/tree/master/v2.0.0/README.md