Open JohnTigue opened 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.
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.
Make sure not to reproduce any of this: http://leafletjs.com/plugins.html#geocoding-address-lookup
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
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
This has the following benefits: