Show locations when move maps
Question
Application Type
Traditional Web
Platform Version
11.0.900.1

Hi guys, I hope you are well.

I have a question on how to create a solution.


The problem:

I have big list of Latitudes and Longitudes in NoSQL database, my list example:

I would like to display these locations on google maps as the user moves the map, or zoom in/out, 

Like airbnb:


So, I need to search for my latitudes and longitudes within a specific area.

already tried some features of this link, but I didn't find a solution:

https://developers.google.com/maps/documentation/


Would anyone have any solution?

any tips will be welcome.


Regards.

mvp_badge
MVP

Hi Agno,


Are you using Google Maps component, right?

If so, you can use the preparation to add the markers and perhaps add a click event on them, like on the image below:


On your case you can use JSON Deserialize to have the list of coordinates into a structure and after that, you iterate on that list like I do on a query on the example above.

MapId should be the name you gave to the GoogleMaps webblock and MarkerOptions has a JSON with customization of the marker:



Hope it helps.


Kind Regards,
João

mvp_badge
MVP

Thanks João,

Will help a lot in a second moment, when I already have my list of latitudes and longitudes filtered.

My impediment now is to know how to get only the records that are within a square on the map.

I can't make a loop of my entire list of latitudes and longitudes as there are thousands of records, so I need to know how to find out the 4 corners of the map for example and filter my list beforehand (in SQLDB), something like:

(Mylist.lat <= latA and Mylist.lat >= latC)

and

(Mylist.long >= longA and Mylist.long <= longD)

In this way the list that would go through the preparation you explained would be just what is really within the area shown on the map.

Regards.

mvp_badge
MVP

Hi Agno,


Ah ok, know I get your problem. In that case, definitely you want to filter on the query to only get the results you want.

To help you with that, you can use CenterMap to center your screen on a given latitude / longitude and use the ZoomMap action and with that you can get the distances covered by the map.


With the use of these two actions and some simple math, you should be able to get the data you need to filter out your coordinates.


Regards,
João

mvp_badge
MVP
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.