I am trying to making a webpage where the user pans and zooms on a map, and based on the location and zoom level, some data is displayed on the webpage (drawn from another source). The data that will be displayed is not spatial data, and it will not be shown on the map. I thought I could have a database for each zoom level, and then when a call to the database is made, it returns the data associated with that location and zoom level.

I saw an approach on the google earth documentation regarding regions and this related SE question. However, I was hoping to use Google maps for this.

The data being returned for each area is just one number. For example, say I wanted to see the number of people in a certain area, it would show that value on the webpage. The first iteration of this I was hoping to do for a city (London), and then see if there were any performance issues.

Is this a reasonable approach? Are there any better ways of doing this, or things that I should be aware of?

  • If your data is "not spatial data" how are you relating it to a location or area on the map? Commented Dec 11, 2010 at 16:33
  • 1
    I meant to say that the resultant data is not spatial (just a number) but it is associated with a spatial area. I suppose it's the same as getting a value from an attribute table of a spatial object.
    – djq
    Commented Dec 11, 2010 at 16:41

3 Answers 3


You could use a Google Maps Map where you listen to the bounds_changed event of the Map object (see Google Maps API).

When you get that event you can access the map.getBounds() to receive the bounds of the visible area in the map and the map.getZoom() to get the current zoomlevel.

If you have the data you want to displayed coded with locations you could retreive data from the other source that fits the current bounds and the current zoomlevel and display to the user.

  • Thanks Peter, that is exactly what I am planning on doing. However, I'm not sure whether it is reasonable to do this for large areas and wonder if there are any good programming strategies to implement this.
    – djq
    Commented Dec 11, 2010 at 16:43
  • 1
    If you add indexes on your datastore (preferably spatial indexes) you can easily do this strategy for huge datasets. Use some kind of spatially enabled DB-backend (SpatialLite, MySQL, Postgresql/PostGis, SqlServer 2008, Oracle Spatial etc.)
    – Peter
    Commented Dec 11, 2010 at 17:45
  • @Peter: how does a spatial index work in general, and for something like this? This is the type of issue I am hoping to learn about as I've never made a large database like this before (and realize it is ambitious).
    – djq
    Commented Dec 11, 2010 at 17:53
  • 1
    Spatial indexing is often implemented as some kind of quadtree or RTree index on a Spatial Column in the database. The ones i mentioned does support spatial indexing natively. For example when using mysql you can create and index like: CREATE SPATIAL INDEX sp_index ON geom (geomcolumn); Where geom column is a column storing some kind of spatial indentifyer.. point, link, rectangle etc. When querying data you can then do: select colname,.. from table where MBRIntersects(spatcolumn,GeomFromText('Polygon((30000 15000,31000 15000,31000 16000,30000 16000,30000 15000))'))
    – Peter
    Commented Dec 11, 2010 at 18:13
  • See: dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html
    – Peter
    Commented Dec 11, 2010 at 18:14

You can use Fusion Tables to display non-spatial data with spatial data on Google Maps http://code.google.com/apis/fusiontables/docs/developers_reference.html#Spatial

An Example is on Google Maps Mania http://googlemapsmania.blogspot.com/2010/11/more-fusion-tables-spatial-queries_20.html

You can control the 'region' by setting a SELECT statement with a defined Rectangle. [so you can define London MBR]

SELECT 'Store Name', Name, Address FROM 292905 WHERE ST_INTERSECTS(Address, RECTANGLE(LATLNG(37.0242,-122.2806), LATLNG(37.5242,-121.6806))) ORDER BY Store Name

See Keir Clarke example http://homepage.ntlworld.com/keir.clarke/web/charities.htm [this uses ORDER BY ST_DISTANCE can be changed to RECTANGLE]

  • I am considering Fusion Tables, but I would prefer to store the data in a way that I do not have to make it all public due to some copyright issues.
    – djq
    Commented Dec 11, 2010 at 17:52

I am trying to create search functionality on move map according to center point of map want to get result. you can see example like www.airbnb.com Please do need full for me .

  • 3
    Welcome to GIS SE! Please ask a new question by selecting the Ask Question option instead of answering with one. You can always link your question with this topic by including the web address.
    – Joseph
    Commented Aug 13, 2014 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.