Solved

Return Records based on selected map area

Posted on 2011-02-11
2
473 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
[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
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

751 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