Currently I'm using the Hierarchical Select widget for Geonames (#437312: Hierarchical Select widget for Geonames) to store the geonameid into a CCK text field. The problem was that there wasn't a way to display that in a nice way on node page.
So I've made this little module that implements a hook_field_formatter_info so it can display the whole hierarchy.
I think there is some potential here: there can be an admin page where you can add different formatters (like imagecache does) for example to display only the Country/Town/Lat/Lon, etc.

This is only a stub, but if there is interest from the Geonames maintainers in this approach I can further continue developing it.

CommentFileSizeAuthor
geonames_content_1.patch2.26 KBandreiashu

Comments

andreiashu’s picture

Status: Active » Needs work

The patch is against the latest dev version of geonames.

andreiashu’s picture

I'll be working on a solution where you can build Geoname display presets (like in imagecache) so this means that the user will have a default preset installed (lets say Hierarchy) but at the same time she will be able to add new display presets.

I'll post the updated patch here.

alex andrascu’s picture

any update on this one ?

andreiashu’s picture

@alex_andrascu: I didn't have time to work on this unfortunately. But I didn't abandon the idea, I just need have a few days free...
Andrei

alex andrascu’s picture

I've been messing a little with http://drupal.org/project/dependent_fields and plain CCK text field with allowed values retrieved from geonames. I might be able to tame it in the end (it's working eratically right now) but it might just make more sense the way you've put it. Care to share with me your solution for getting HS to work with a CCK field ?

Right now i have one field with PHP allowed values like this:

$options = array(
  'sortby' => 'countryname',
);
$query = array('lang' => 'RO');
$result=geonames_query('countryinfo', $query, $options);
foreach ($result->results as $country) {
   $row[$country['geonameid']] = $country['countryname'];
}
return $row;
 

I'm interested in getting either another field containing cities or just store the hierarchy in the same field.

Thanks alot for getting back.
Alex