Level 1

0% to

Level 2

Tip /

to gain points, level up, and earn exciting badges like the new
Mission!

View all

# Adobe Experience Manager Sites & More

## To find all the nearby locations(latitude and longitude values) within a radius for a provided location(a single latitude and longitude)

RkR_F5
Level 1

Likes

0 likes

Total Posts

9 posts

0 solutions
View profile

RkR_F5
Level 1

Likes

0 likes

Total Posts

9 posts

0 solutions
View profile
RkR_F5
Level 1

06-05-2021

Hi Team,

Got a requirement where, we have a path /etc/storelocator in aem. Under this path, we have several child nodes and each node contains 2 properties latitude and longitude. Please see the scrrenshot below:

Now, we need to find all those nodes which are nearby to a location within a provided radius.

For example, let say radius = 10 km and location is {45.4286698 , -122.5752410}. we need to find all the nearby locations and its corresponding nodes under /etc/storelocator nodes.

Any input is highly appreciable.

Thanks!

#### Accepted Solutions (1)

Arun_Patidar
MVP

Likes

1,345 likes

Total Posts

3,220 posts

914 solutions
View profile

Arun_Patidar
MVP

Likes

1,345 likes

Total Posts

3,220 posts

914 solutions
View profile
Arun_Patidar
MVP

08-05-2021

Hi,

The approximate conversions are:

• Latitude: 1 deg = 110.574 km
• Longitude: 1 deg = 111.320*cos(latitude) km

You can use this logic to scan nodes and filter out neraby nodes.

KiranVedantam1992
Level 7

Likes

169 likes

Total Posts

175 posts

54 solutions
View profile

KiranVedantam1992
Level 7

Likes

169 likes

Total Posts

175 posts

54 solutions
View profile
KiranVedantam1992
Level 7

07-05-2021

Hi @RkR_F5 ],

You can find the distance between 2 points by writing code in JS. Please find a related URL here.

Hope this helps.

Thanks,

Kiran Vedantam

asutosh_jena
Level 10

Likes

544 likes

Total Posts

663 posts

190 solutions
View profile

asutosh_jena
Level 10

Likes

544 likes

Total Posts

663 posts

190 solutions
View profile
asutosh_jena
Level 10

07-05-2021

Hi @RkR_F5

Hi

Please go through the below article:

http://theoryapp.com/store-locator-using-java/

The basic idea is as below:

• Design a Store class, and load all data into an ArrayList of Stores.
• Ask the user for an address, and find its geographical location.
• Scan through the ArrayList of all stores to find the closest one.