I hacked the Openlayers Geocode to populate the autocomplete field of the Content Taxonomy module widget.
I wish I could find a way to create a hierarchy of taxonomy with states being children of countries.
I'm not sure who to be asking about this so I'll copy a post I put in hierarchical select module issue queue here.
The Openlayers Geocode module has the ability to auto populate text fields with address information. There is an autocomplete field that sends the information to a Google Geocode and location service. It returns lat, long, address, city, state and country which are used to populate the respective text fields. The returned data is consistent so any address in Boston will return the values Boston, MA, and USA and in Wood Hole the values returned are Woods Hole, MA, and USA.
Wouldn't it be grand to be able to sort through these values using Hierarchical Select on an exposed filter? I don't even know if it's possible to use Hierarchical Select as an exposed filter.
Here is the database table from the geocode address field (notice the last to columns refer to taxonomy ids):
vid nid field_street_value field_city_value field_state_value field_country_value field_address_openlayers_wkt field_text_value field_content_taxonomy_country_value field__content_taxonomy_state_value
14 14 NULL Newport RI USA GEOMETRYCOLLECTION(POINT(-71.3128285 41.4901024)) NULL NULL NULL
17 17 NULL Miami FL USA GEOMETRYCOLLECTION(POINT(-80.1936589 25.7742657)) NULL NULL NULL
18 18 NULL Wood Holes MA USA GEOMETRYCOLLECTION(POINT(-88.7878678 43.7844397)) NULL 1 2
19 19 NULL Boston MA USA GEOMETRYCOLLECTION(POINT(-71.0597732 42.3584308)) NULL 1 2
Here is the term_data table (notice the nice correspondence to field_city_value and field_state_value in the above table):
tid vid name description weight
1 1 USA 0
2 1 MA 0
I think what is important here is that I just typed in Woods Hole (my spelling was corrected by the Google Geo service which creates consistency) and then on another node I typed Boston and it returned all that data and populated the term_data table automatically because I used the autocomplete text field in the Content Taxonomy module with the autocomplete Openlayers Geocode (I changed 2 lines of code, simple) The data is consistent.
What I need to do now is create a parent / child structure between taxonomy terms that are countries (from field_content_taxonomy_country_value) and taxonomy terms that are states (field__content_taxonomy_state_value.)
Here is the term_hierarchy table (notice that there is no parent structure):
tid parent
1 0
2 0
Does anybody have any idea how to do this? Imagine having five thousand nodes that used the Geocode to save the address and to be able to use the Hierarchical Select module to sort by country, state, region, ect. and have Views return the lat / long coordinates as WKT that then becomes a dynamic layer on a map. That would be too awesome.
Comments
GeoPlanet?
Personally I'd like to have time to import the GeoPlanet dataset from http://developer.yahoo.com/geo/geoplanet/data/ which contains a hierarchical set of locations each with a unique ID (called a WOEID). Additionally there's a concordance API call that translates from other providers' unique IDs (eg Geonames, OSM etc) to WOEIDS... http://developer.yahoo.com/geo/geoplanet/guide/api-reference.html#api-co...
Cheers,
A
It would be simpler to use
It would be simpler to use Geo Taxonomy for this sort of task, because you could build around existing Taxonomy-module infrastructure and interfaces.
Not rich enough
I may be wrong, but I'm not sure GeoTaxonomy provides a rich enough data structure for the metadata associated with data coming out of these geodatabases.
The idea would be to map each
The idea would be to map each address component (country, administrative areas, city, etc...) with a taxonomy term, Geo Taxonomy will then add, to each term, spatial information (like boundary box). I think Geo Taxonomy is the way to go here, it was also in the initial plans for the OpenLayers Geocoder module (see its project page), I just don't have, at the moment, a good use case to develop such an integration, but patches are always welcome.
Definitely not - Geo Taxonomy
Definitely not - Geo Taxonomy is a lightweight solution. For the original stated problem, "I wish I could find a way to create a hierarchy of taxonomy with states being children of countries.", it works perfectly.
Same problem Here
Adam S, I have the same problem as You. Openlayers geocoder is really intuitive, and even if in views they are ways to display even just text based results, those fields need to be prepopulated somehow...
Really strange, nobody though about that. If you found any solution, in the meanwhile, please let me know...