ns plugin add @nativescript/google-maps-utilsRequires google maps plugin @nativescript/google-maps
Install the mixins to the GoogleMaps object
import { installMixins } from '@nativescript/google-maps-utils';
installMixins();You can access the google maps utilities from the GoogleMaps object after the mixins have been installed.
onMapReady(args: MapReadyEvent) {
const map = args.map;
}import { HeatmapTileProvider, HeatmapOptions } from '@nativescript/google-maps-utils';
import { GoogleMap, Coordinate } from '@nativescript/google-maps';
addHeatmapOverlay(map: GoogleMap, heatmapOptions: HeatmapOptions) {
// Create a new heat map tile provider
const heatmapProvider = new HeatmapTileProvider(heatmapOptions);
// Pass tile provider to Google Maps
const heatmapOverlay = map.addTileOverlay({
tileProvider: heatmapProvider,
});
}| Property | Type |
|---|---|
coordinates |
Coordinate[]; |
opacity |
number; |
radius |
number; |
maxIntensity |
number; |
gradient |
IGradient[]; |
import { ClusterManager } from '@nativescript/google-maps-utils';
import { GoogleMap, MarkerOptions } from '@nativescript/google-maps';
addClusteredMarkers(map: GoogleMap, markers: MarkerOptions[]) {
const clusterManager: ClusterManager = map.clusterManager(markers);
}Features that are not yet fully implemented or likely to change.
Currently only supports GeoJson Objects.
import { GeoJsonLayer, IGeometryStyle } from '@nativescript/google-maps-utils';
onMapReady(args: MapReadyEvent) {
const style: Partial<IGeometryStyle> = {
fillColor: new Color('blue'),
strokeColor: new Color('red'),
width: 4,
}
map.addGeoJson({
geoJson: geoJson,
style: style,
});
}import { GeoJsonLayer } from '@nativescript/google-maps-utils';
removeGeoJsonLayer(map: GoogleMap, layer: GeoJsonLayer) {
map.removeGeoJson(layer);
}Apache License Version 2.0