Perspective map question

hello , I wanted to put a text field to be able to search on the map. it’s possible?

I also want to put a button to position the map according to the user’s location.

Thank you so much.

If you’re using a version before 8.1.5, you would need to place these components in the view around the Map - there is no way to put them “inside” the Map. If you’re using 8.1.5 or newer, you can place these components into a different View and then use the Map.props.customControls property to specify the view which contains those components so that they can be housed “within” the boundaries of the map.

As far as a “search”, I have no idea how you would do that because the map has no concept of searching; the Map only display visual information based on coordinates you specify. You would need to link your text field to some sort of http request which returns coordinate information based on the text and then link that returned data to the map in some way. This could get really complicated based on the number of results returned.

As far as centering the map based on the user’s coordinates, you would just do something like the following on the button (assuming the button is a sibling of the map):

self.getSibling("Map").props.center = {'lat': self.session.props.geolocation.latitude, 'lng': self.session.props.geolocation.longitude}

Note that this doesn’t work very well for non-mobile devices.

1 Like

@cmallonee said how to get the current location.
But for your other request, the straight way to do this is by http binding.
To find places you can read about Nominatim API, I managed to make it work and has a decent search response and results. But the better way to do this tho, is to generate and API KEY with Google Dev tools of Places Search.

Here are the results with Nominatim:


Want to give a look of how I’m doing this, send a message.

hello @jespinmartin1,
I think I will do it with a database … I will manually enter the coordinates of each site
and when a place is clicked, send the map to the saved coordinates.

although I would like to know how you have done to learn.