JohnTigue / idots

A web data standard for Infectious Disease Outbreak Time Series (IDOTS), and related software
http://tigue.com/
Apache License 2.0
3 stars 0 forks source link

Geocoding #73

Open JohnTigue opened 9 years ago

JohnTigue commented 9 years ago

The geocoder takes names and turns them into [long,lat]. A reverse geocoder takes [long,lat]s and turns them into names (see #43).

The geocoder should evolve as follows

  1. Completely naive: each lookup hits a remote geocoder
  2. Caching: results are stored in memory, simply url encoded names as properties on an Object.
  3. Pre-loaded cache: an external CSV file is loaded on startup and used to populate the cache. For EbolaMapper 2014Ebola, this will be loaded with Sierra Lione, Libaria, and Ginea data (ADM0, ADM1, ADM2).

This has the following benefits:

  1. easy init coding
  2. add on cache as a filter easily later.
  3. performant once the cache is online.
  4. still works with unknown names i.e. will still fall back to calling a geocoder API.
JohnTigue commented 9 years ago

Might as well tie this to Leaflet i.e. plug-in which returns a L.latLng. At a lower level perhaps there is a "class" which doesn't know about Leaflet. (probably not, as LatLng is pretty lightweight.

JohnTigue commented 9 years ago

For the pre-loaded cache, there should be a set of static files for all ADM0,1,2,3,4 data in the world. The non-overlapping model in ADM-land makes for a perfect mapping to a tree of files.

And how is naming done? And the index? each file is a CSV so there should be an index.csv? As well as an index.html, and index.xml? Certainly there is an index.js which is JSON with links to the GeoJSON files.

A dir will have an index and (possibly) sub-divisions i.e. sub-dirs.

There should be a way of saying "Give me all, say, AMD0 through ADM4 data for AMD0=foo. Or should there be? perhaps that is derived by the client?

And the same directory structure would handle loc-name to loc-name.geojson. The CSV links to the GeoJSON boundary files, which could be relative or remote URLs.

JohnTigue commented 9 years ago

Make sure not to reproduce any of this: http://leafletjs.com/plugins.html#geocoding-address-lookup

JohnTigue commented 9 years ago

Also consider the Mapbox API: https://www.mapbox.com/developers/api/geocoding/ https://www.mapbox.com/mapbox.js/example/v1.0.0/geocoding/

http://gis.stackexchange.com/questions/21890/does-leaflet-js-api-provide-a-geocoding-service/46799#46799

JohnTigue commented 9 years ago

Cheap caching mechanisms (go with the first answer first): http://stackoverflow.com/questions/368280/javascript-hashmap-equivalent

Note the last answer says: underscore.js or collections.js