-
-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
triniwiz commentedon May 10, 2022
Hi sorry about this we will be adding it soon, hopefully this might help you out.
MikeBrsk commentedon May 10, 2022
Thank you, this does help a lot. Appreciate the fast response
hanzymester commentedon May 20, 2022
How to remove all added markers:
function onMapReady(args) {
mapView = args.map
// this will remove added markers:
mapView.clear()
}
vicmasa commentedon Jun 1, 2022
Hello friends.
It also doesn't show how to get the position of the center of the map (latitude and longitude). The latitude and longitude of the map, it seems that they are not observable objects.
triniwiz commentedon Jun 1, 2022
@vicmasa
map.cameraPosition.target
should have thoseDanLatimer commentedon Jun 22, 2022
I just spent a week reading source code and making assumptions to try to work with the new google maps library due to lack of documentation.
Thought I'd post a few of the things I learned here for others also struggling
Grab access to the GoogleMaps object on map ready
To create/remove markers/polylines/polygons/circles there are functions on the map that accept those object's respective options. Similar to the js api but not the same, you can't just add the map to the objects and they'll apear on the map like the js api, you need to call createMarker/removeMarker etc.
To move the camera to a bounding box around the markers
to set the map tile type (satellite, hybrid, normal etc), this method seems to be undocumented even in the .d.ts file. I was able to access it off MapView._map.setMapType() but I believe that MapView._map /is/ just the GoogleMap instance so you should be able to access it without using that private, I just didn't have the GoogleMap where I was working in the code so I can't say for sure.
chingcui commentedon Jul 21, 2022
Could you check if the sample code for showing the info window is working? I am using the same sample code, and when I click on the marker, it only shows the title of the marker, not the custom info window with the StackLayout defined in the sample. thanks.
liamcharmer commentedon Jul 26, 2022
Any docs with regard to how to add markers?
chingcui commentedon Jul 27, 2022
check this sample https://gist.github.com/triniwiz/3b410bce5d126326036efec58f6cba5c
Semurak commentedon Aug 20, 2022
Hello, is there an easy way to get the bounds of the current view? Maybe with an event like "onBboxChanged"?
Thanks!
triniwiz commentedon Aug 20, 2022
Have you tried
cameraPosition
event ? https://docs.nativescript.org/plugins/google-maps.html#eventsSemurak commentedon Aug 20, 2022
No, but this is the first step to check for changes! Thanks!
How can I calculate the bounds from cameraPosition target? Target is the center of the map, Right?
Edit: Maybe it could be done via
Projection -> visibleRegion -> latLngBounds
from SDK but this property is sadly not exposed in the plugin.herefishyfish commentedon Aug 23, 2022
Is that not just
?
Semurak commentedon Aug 23, 2022
Well, yes and no. It's a workaround, but it's not correct for a map with tilting and bearing.
For my project it's enough, but you should expect wrong bounding boxes for edge cases.
Thanks for the reply and help! 😊
herefishyfish commentedon Aug 24, 2022
Hmm that's interesting! Will have to take a look at that.
The iOS SDK doesn't have a latlngBounds so that's probably the reason @triniwiz left it out.
You can still access it from the native object on Android like so: