What code enables the map to automatically take our current location?

What code do i need to enter so that the map automatically sets my current location and sets the name of the place i have entered in a textbox as the destination ?

umm to take to current location you can use location sensor and in these blocks replace those first 2 number blocks with lat and long.

1 Like

Hello there,

From the Google Maps documentation: you can search the place with a WebViewer.

For example, if I want to search "pizza seattle wa", I use:

https://www.google.com/maps/search/?api=1&query=pizza+seattle+wa

As Aarush pointed out, you can use a LocationSensor to track the location, then use this.

1 Like

For more detail, I just published a new guide.

3 Likes

Thanks a lot ! @gordonlu310 you are a real pro at this thing. Thanks to you too @Aarush_Kumar

2 Likes

Depending on your app's requirements, you might consider a Map control with Navigate:

The example shows how to do what you want and will also provide the route to get to the destination.

2 Likes

I want to make an app that has a map and can also navigate us to any place we search. So I want the app to add a marker at our current location and a different colour marker at the destination.

Try this

You can directly use this in a WebViewer.

Also, what if the user did not store Lat and Long? Aren't they the same without Lat and Long?

Here is an example without TinyDB. Enter the destination in the text box.

I hope I understood the question correctly.