You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/plugins/google-maps.md
+110-117
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,6 @@ A plugin that allows you to use the [Maps SDK](https://developers.google.com/map
21
21
22
22
-[Use @nativescript/google-maps with Angular](#use-nativescriptgoogle-maps-with-angular)
23
23
-[Use @nativescript/google-maps with Vue](#use-nativescriptgoogle-maps-with-vue)
24
-
-[Control the camera](#control-the-camera)
25
-
-[Set the map type](#set-the-map-type)
26
-
-[Styling The Map](#styling-the-map)
27
24
28
25
-[API](#api)
29
26
@@ -33,10 +30,14 @@ A plugin that allows you to use the [Maps SDK](https://developers.google.com/map
33
30
-[GoogleMap Object](#googlemap-object)
34
31
-[Properties](#properties)
35
32
-[Methods](#methods)
36
-
-[Camera Position](#camera-position)
37
-
-[Projection](#projection)
38
-
-[UISettings](#uisettings-interface)
39
-
-[MapType enum](#maptype-enum)
33
+
-[Control the camera](#control-the-camera)
34
+
-[Camera Position](#camera-position)
35
+
-[Projection](#projection)
36
+
-[Map Customization](#map-customization)
37
+
-[UISettings](#uisettings-interface)
38
+
-[Setting the map type](#setting-the-map-type)
39
+
-[MapType enum](#maptype-enum)
40
+
-[Styling The Map](#styling-the-map)
40
41
-[Markers](#markers)
41
42
-[Adding Markers](#adding-markers)
42
43
-[Marker Object](#marker-object)
@@ -192,17 +193,6 @@ import { GoogleMapsModule } from '@nativescript/google-maps/angular';
192
193
193
194
2. Add [MapView](#mapview-class) to your markup.
194
195
195
-
```html
196
-
<MapView
197
-
(mapTap)="onTap($event)"
198
-
(mapLongPress)="onLongPress($event)"
199
-
(markerTap)="onMarkerTap($event)"
200
-
>
201
-
</MapView>
202
-
```
203
-
204
-
3. Manage
205
-
206
196
```html
207
197
<MapView
208
198
(ready)="onReady($event)"
@@ -262,79 +252,6 @@ To handle the map features, see the [GoogleMap object](#googlemap-object) API.
262
252
263
253
3. To manage the mapping features, listen to the map view's `ready` event and get the reference to the [GoogleMap](#googlemap-object) instance from the event data.
264
254
265
-
### Control the camera
266
-
267
-
To programmatically update the camera position, call the `animateCamera()` method on the `GoogleMap` object and pass it a [CameraUpdate](#cameraupdate-class) instance.
See [CameraUpdate](#cameraupdate-class) for more methods you can call and pass to the `animateCamera()` method.
295
-
296
-
### Styling the map
297
-
298
-
You can style the map's items, such as roads, parks, businesses, and other points of interest.
299
-
300
-
Styling works only on the [normal](#maptype-enum) map type. Styling does not affect indoor maps.
301
-
302
-
To style your map, use a JSON file generated by the [Google Maps APIs Styling Wizard](https://mapstyle.withgoogle.com). In addition to changing the appearance of features, you can also hide features completely.
303
-
304
-
```json
305
-
[
306
-
{
307
-
"featureType": "all",
308
-
"stylers": [{ "color": "#C0C0C0" }]
309
-
},
310
-
{
311
-
"featureType": "road.arterial",
312
-
"elementType": "geometry",
313
-
"stylers": [{ "color": "#CCFFFF" }]
314
-
},
315
-
{
316
-
"featureType": "landscape",
317
-
"elementType": "labels",
318
-
"stylers": [{ "visibility": "off" }]
319
-
}
320
-
]
321
-
```
322
-
323
-
To apply a custom style to your map you can set the `mapStyle` property on your `GoogleMap` object:
|`preventDefaultMarkerTapBehavior`|`boolean`| Prevents the default marker event handling (panning/info windows) done by Google Maps |
353
271
354
272
#### Events
355
273
@@ -384,7 +302,7 @@ The following properties are available for adjusting the camera view on initiali
384
302
385
303
### GoogleMap Object
386
304
387
-
This class provides the mapping features and its instance is available from the [MapView](#mapview-class)instance's `ready`[event](#events):
305
+
This class encapsulates the core, cross-platform mapping features. Its instance is made available when the [MapView](#mapview-class)fires the `ready`[event](#events), and this is where you'll perform the majority of your mapping tasks.
388
306
389
307
```ts
390
308
function onReady(event:MapReadyEvent) {
@@ -434,6 +352,26 @@ function onReady(event: MapReadyEvent) {
434
352
435
353
consult the appropriate SDK reference on how to use it: [iOS](https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_map_view) | [Android](https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap)
436
354
355
+
## Control the camera
356
+
357
+
To programmatically update the camera position, call the `animateCamera()` method on the `GoogleMap` object and pass it a [CameraUpdate](#cameraupdate-class) instance.
The Google Maps API offers the following five types of maps:
@@ -501,9 +452,51 @@ The Google Maps API offers the following five types of maps:
501
452
|`Terrain`| Topographic data. The map includes colors, contour lines and labels, and perspective shading. Some roads and labels are also visible. |
502
453
|`Hybrid`| Satellite photograph data with road maps added. Road and feature labels are also visible. |
503
454
504
-
### Markers
455
+
### Styling the map
456
+
457
+
You can style the map's items, such as roads, parks, businesses, and other points of interest.
458
+
459
+
Styling works only on the [normal](#maptype-enum) map type. Styling does not affect indoor maps.
460
+
461
+
To style your map, use a JSON file generated by the [Google Maps APIs Styling Wizard](https://mapstyle.withgoogle.com). In addition to changing the appearance of features, you can also hide features completely.
462
+
463
+
```json
464
+
[
465
+
{
466
+
"featureType": "all",
467
+
"stylers": [{ "color": "#C0C0C0" }]
468
+
},
469
+
{
470
+
"featureType": "road.arterial",
471
+
"elementType": "geometry",
472
+
"stylers": [{ "color": "#CCFFFF" }]
473
+
},
474
+
{
475
+
"featureType": "landscape",
476
+
"elementType": "labels",
477
+
"stylers": [{ "visibility": "off" }]
478
+
}
479
+
]
480
+
```
481
+
482
+
To apply a custom style to your map you can set the `mapStyle` property on your `GoogleMap` object:
You can create markers using the [GoogleMap](#googlemap-object)'s object `addMarker` method by passing it a [MarkerOptions](#markeroptions) object.
509
502
@@ -542,14 +535,14 @@ It implements the [MarkerOptions] interface and has the following additional met
542
535
|`userData`|`any`| Additional information assigned to the marker |
543
536
|`zIndex`|`number`| Z-index of the marker |
544
537
545
-
### Coordinate
538
+
####Coordinate
546
539
547
540
| Property | Type |
548
541
| :------- | :------- |
549
542
|`lat`|`number`|
550
543
|`lng`|`number`|
551
544
552
-
####Removing Markers
545
+
### Removing Markers
553
546
554
547
To remove a marker from the map, call the `removeMarker()` method on the [GoogleMap](#googlemap-object) instance and pass it the marker to be removed.
555
548
@@ -559,7 +552,7 @@ function removeMarker(map: GoogleMap, marker: Marker) {
559
552
}
560
553
```
561
554
562
-
###Circles
555
+
## Circles
563
556
564
557
### Adding Circles
565
558
@@ -586,7 +579,7 @@ function addCircle(map: GoogleMap, circleOptions: CircleOptions): Circle {
586
579
|`zIndex`|`number`|
587
580
|`userData`|`{ [key: string]: any }`|
588
581
589
-
####Removing Circles
582
+
### Removing Circles
590
583
591
584
You can remove a circle using the [GoogleMap](#googlemap-object)'s `removeCircle()` method.
592
585
@@ -596,9 +589,9 @@ function removeCircle(map: GoogleMap, circle: Circle) {
596
589
}
597
590
```
598
591
599
-
###Polygons
592
+
## Polygons
600
593
601
-
####Adding Polygons
594
+
### Adding Polygons
602
595
603
596
You can create polygons using the [GoogleMap](#googlemap-object)'s object `addPolygon()` method by passing in the specified [PolygonOptions](#polygonoptions).
@@ -635,9 +628,9 @@ function removePolygon(map: GoogleMap, polygon: Polygon) {
635
628
}
636
629
```
637
630
638
-
###Polylines
631
+
## Polylines
639
632
640
-
#####Adding Polylines
633
+
### Adding Polylines
641
634
642
635
You can create Polylines using the [GoogleMap](#googlemap-object)'s object `addPolyline` function by passing it a [PolylineOptions](#polylineoptions) object.
643
636
@@ -667,7 +660,7 @@ function addPolyline(
667
660
|`endCap`| Cap & Partial\<NativeObject\>|
668
661
|`userData`|`{ [key: string]: any }`|
669
662
670
-
####Removing Polylines
663
+
### Removing Polylines
671
664
672
665
You can remove a Polyline using the [GoogleMap](#googlemap-object)'s `removePolyline` function, like so:
673
666
@@ -677,9 +670,9 @@ function removePolyline(map: GoogleMap, polyline: Polyline) {
677
670
}
678
671
```
679
672
680
-
###Ground Overlays
673
+
## Ground Overlays
681
674
682
-
#####Adding Ground Overlays
675
+
### Adding Ground Overlays
683
676
684
677
You can create Ground Overlays using the [GoogleMap](#googlemap-object)'s object `addGroundOverlay` function by passing in the specified [GroundOverlay Options](#groundoverlayoptions).
685
678
@@ -710,7 +703,7 @@ function addGroundOverlay(
710
703
|`anchorU`|`number`|
711
704
|`anchorV`|`number`|
712
705
713
-
####Removing Ground Overlays
706
+
### Removing Ground Overlays
714
707
715
708
You can remove a GroundOverlay using the [GoogleMap](#googlemap-object)'s `removeGroundOverlay` function, like so:
716
709
@@ -722,7 +715,7 @@ function removeGroundOverlay(map: GoogleMap, groundOverlay: GroundOverlay) {
722
715
723
716
## Tile Overlays
724
717
725
-
####Adding Tile Overlays
718
+
### Adding Tile Overlays
726
719
727
720
You can create Tile Overlays using the [GoogleMap](#googlemap-object)'s object `addTileOverlay` function by passing in the specified [TileOverlay Options](#tileoverlayoptions).
728
721
@@ -748,7 +741,7 @@ function addTileOverlay(
748
741
749
742
Setting tile overlay options after the tile overlay has been added to the map can have no effect on the tile overlay. To update the tile overlay, you may need to call `clearTileCache()`.
750
743
751
-
####Removing Tile Overlays
744
+
### Removing Tile Overlays
752
745
753
746
You can remove a TileOverlay using the [GoogleMap](#googlemap-object)'s `removeTileOverlay` function, like so:
754
747
@@ -758,7 +751,7 @@ function removeTileOverlay(map: GoogleMap, tileOverlay: TileOverlay) {
758
751
}
759
752
```
760
753
761
-
####Tile Providers
754
+
## Tile Providers
762
755
763
756
Tile providers are objects that provide tiles to be used in a Tile Overlay.
0 commit comments