I’ve got an application where I would like to present the end user with a google map and allow them to select an area of the map with a simple rectangular drawing tool and then have all of the locations stored in the client’s database that fall in that rectangular selection area show up as points on the map…
I have a simple understanding of google maps and can get google maps to plot all the locations on the database w/o a problem… my problem comes in allowing the end user to draw the rectangle. Not sure how to implement this.
Can someone explain or link me to an example of how it’s done?
Interesting question. I love the google maps api. Here is a jsFiddle with your solution:
http://jsfiddle.net/JsAJA/2/
You will have to query your database for points between the minimum/maximum lat and lngs. Hope this helps.
Bob
P.S. Note that this breaks the natural user experience of google maps. The map is no longer dragged when you mouse down. It needs a better user experience.