Migrating google maps api app from fusion tables to datastore + data layer

248 views Asked by At

I'm planning my migration away from fusion tables. My current implementation (on gae) has a fusion table with hundreds of locations and displays it on a fusion tables layer via the google maps api. Filtering of locations is done by modfiying the fusion tables query in javascript on the client.

My plan is to migrate to the google app engine datastore combined with a google maps data layer. But I'm completely puzzled how to implement the retrieving and displaying of data, also when the user is browsing the map (zooming, panning) or applying filters, as this was all taken care of by the fustion tables layer.

Should I query for data that is visible on the current map view only, and query again when the user goes to a different view? (when panning a map, this will be lots of queries). Or should I querying for all data, even it is out of view? (looks like less of a hassle on the implementation, but is not scalable when datasets grow).

How about filtering. When the user applies a filter, should I query for data again, or is it better to implement the filter on the client side and hide items on the map via map styles?

Would it make sense to use the geojson format to transfer data from the server to the client, so it can be used to populate the data layer without further processing?

What will happen if a user zooms out all the way? Must I then transfer the complete dataset to the client and from there back to the google maps api for rendering? That doesn't seem scalable either?

With fusion tables, that was all taken care of… Now there's so many choises to be made!? There should be some kind of common approach to this kind of use case, shouldn't there?

Here's a screenshot of my app, to show the amount of data that's involved (can grow!)

enter image description here

1

There are 1 answers

1
Alex On

I have something similar going on. For me a single datastore query & fetch caps out at a couple hundred records before the http request timesout. So that won't handle your 'zoom out' scenario very well.

Another thing to note is that datastore will not be able to do an inequality filter on both latitude and longitude. https://cloud.google.com/appengine/docs/standard/python/datastore/query-restrictions#inequality_filters_are_limited_to_at_most_one_property

Currently I publish my entire list of ~10k points as a json file into google cloud storage and then my endpoint serves that cached file instead of actually doing the fetch. https://cloud.google.com/appengine/docs/standard/python/tools/webapp/blobstorehandlers#Using_with_GCS

On the Client side I just feed the whole thing into the google maps sdk. The map performs fine, if you enable things like marker clustering. https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.optimized https://developers.google.com/maps/documentation/javascript/marker-clustering