Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 12, 2014, 06:14 PM   #1
JamesD95
macrumors newbie
 
Join Date: Apr 2014
Map issue HTML5 & CSS3

Hello,

I am trying to create a interactive map. From a certain place e.g a business and for a circle for the radius, which has been set. From this the user can enter their postcode and find whether an item can be delivered to their address and display on the map that they are outside the area the item is delivered.

Any help will be much appreicated
JamesD95 is offline   0 Reply With Quote
Old Apr 13, 2014, 02:18 AM   #2
Moshu
macrumors member
 
Join Date: May 2012
I would take the following steps:

1. define the business GPS coordinates (check Google Maps)
2. find a way to translate the customer's postal code or address into GPS coordinates
3. calculate the distance between the two GPS coordinates and compare it with your pre-defined radius. Inform the customer it's outside the area if needed.
4. if you want to also display this in a graphical manner, you can try Google Maps again or create your custom solution

In this moment, for me it looks like point 2 is the biggest unknown and maybe hardest to implement as I never did this.

The others are pretty easy.

Good luck!
__________________
iPhone 5s 16GB iPad Mini Retina 3G 16GB 2012 13" MacBook Air i5 4GB 256 GB 2011 Airport Extreme 2012 Airport Express
Moshu is offline   0 Reply With Quote
Old Apr 13, 2014, 10:53 AM   #3
Haynzee
macrumors member
 
Join Date: Mar 2012
You can use Google Maps Geocoding to convert a postcode into a co-ordinate.

https://developers.google.com/maps/d...ocoding-simple

You can then use the Distance Matrix API to calculate the distance.

https://developers.google.com/maps/d...istancematrix/
Haynzee is offline   0 Reply With Quote
Old Yesterday, 02:57 PM   #4
morespce54
macrumors 65816
 
morespce54's Avatar
 
Join Date: Apr 2004
Location: Around the World
As mentioned above, it's all about geo-coding and reverse geo-coding. Both can be done, at least with Google Map API.

The basic idea is that you take a civic address (or postcode), use the API to translate it to longitude and latitude, take your business longitude and latitude, use the matrix to calculate the distance between your business and the user's address (or postalcode), check if it's within your range and then, if need be, translate the location (longitude and latitude) of the nearest location back to regular civic address and return it to the user.

Long story short, your calculations must be done in longitude and latitude. So you must translate all your civic addresses (your own and the one entered by the user) since that's the easiest (only?) way to calculate the distance between to point.
__________________
..:.::.:.:.::..:.: Oh, I get it. It's very clever :.:.::.:.:.::.:..:.::..:.::.:..:.::.:.::.:.::..
DO NOT OPERATE YOUR COMPUTER UNDER THE INFLUENCE!
morespce54 is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:21 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC