Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Return Records based on selected map area

Posted on 2011-02-11
Medium Priority
485 Views
Dear Experts,

I appreciate this is a big ask, however we would like to introduce functionality into our real estate website which allows users to draw an area on a google map which upon form submission will query the database and return properties which fall within the selected area.

All the records within our database have latitude and longitude values but I have no idea where to start with regards returning these records.

We have a test page which allows users to draw an area on a map at the following URL:
http://www.bspc.co.uk/gbmap.asp

However, I wondered if anyone could suggest how we can achieve the above using this?

Thanks

0
Question by:grantballantyne
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 40

Expert Comment

ID: 34871426
using this you can get the latitude and longitude of a point on a map

you can then fetch the records for that point
0

LVL 3

Accepted Solution

Maximus5684 earned 2000 total points
ID: 34919266
If the Google Maps API you are using returns the boundaries of the box that is drawn (assuming that it is a box), it should give them back in lat/long format. Have the page use AJAX to send these lat/long pairs back to a processing page. Have that page do the following:

If it gives back four sets of lat/long pairs, pair down the identical latitudes and the identical longitudes to get the lat/long pair of the upper-left boundary point and the lower-right boundary point. If it only gives two lat/long pairs, you can skip that step. Take the latitudes and sort them in ascending order then search your database for any points between the upper and lower latitudes. This produces result set 1. Now take the longitudes and sort them in ascending order. Then search result set 1 for longitudes between the upper and lower longitudes. This will produce result set 2 which will include all of the points you're looking for. Now, use AJAX to send a message back to the calling page that includes all of the lat/long pairs for the points you want to place on the map. Have a JavaScript function on the page receive the results of the AJAX call and add points on the map tiles corresponding to the lat/long pairs.

That's the general overview. Detail of each of the steps are hard to define without knowing more about the Google Maps API and some details of your website's setup.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
###### Suggested Courses
Course of the Month7 days, 17 hours left to enroll