Jishad P
Jishad P

Reputation: 77

How to Check Geocode included in a Range of Place?

I am developing web application that deals with a shopping cart. Including customer registration and store registration.

When registering a store we are collecting the latitude and longitude of the store position. Once the store releasing any notifications, first needs to check the Customer addresses having 1 KM radius of the store position.

Only the satisfied customers want the notification.

I am collecting the Latitudes and longitudes of 1 KM range with Here Map API.

Here Map Isoline API

The response of the above API is a bunch of Latitudes and Longitudes.

How can I check my Store latitude and longitude is in this range of Geo-codes.

I tried in_array function of PHP and not accurate with that. Is there any other solution for this ?

Thanks

Upvotes: 0

Views: 207

Answers (1)

Binnilal
Binnilal

Reputation: 170

Already you are saving the store's latitude and longitude. You can get the latitude and longitude of customer address. https://developers.google.com/maps/documentation/geocoding/intro

Then calculate the distance between the latitude and longitude using the method. Calculate distance in meters when you know longitude and latitude in java

If the distance is less than 1km, then execute push notification script for that customer.

Upvotes: 1

Related Questions