Solved

Return Records based on selected map area

Posted on 2011-02-11
2
458 Views
Last Modified: 2012-05-11
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
Comment
Question by:grantballantyne
2 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 34871426
using this you can get the latitude and longitude of a point on a map
http://www.tech-recipes.com/rx/2403/google_maps_get_latitude_longitude_values/

you can then fetch the records for that point
0
 
LVL 3

Accepted Solution

by:
Maximus5684 earned 500 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to create an extensible mechanism for linked drop downs.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now