I'm a long ways from fully understanding the underlying automation, but the autocomplete for addresses was not working for me. When entering city, county, state, country, the drop-down would populate with error hints: 0 Error occurrred on line 536 of file autocomplete.php in function autocomplete_PLAC 1 called from line 91 of file autocomplete.php
As I slipped in some instrumentation code, your line 536 won't match mine.
One of the instrumentation changes I slipped in a few lines above was:
print "<pre>$url</pre>\n";
autocomplete.php
From this I could experiment directly with geonames.org, and made a few discoveries, and a nice-to-have:
1. The url $url = "http://ws.geonames.org/searchJSON", can change to the secure form https.
2. They now require a username. The service remains free, and creating an account was trivial. But for PhpGedView, I think we need a configuration option (e.g. accessible via admin.php I suppose). For testing, I hardcoded my username in to my instance of autocomplete.php.
3. "?name_startsWith=" should change to "?placename_startsWith=".
4. I added "&countryBias=USA", so geonames puts those at the top of the list. While creating a new configuration operation (for #1), perhaps this could be slipped in as an option.
The geonames main page - http://www.geonames.org/ has a Documentation link. But I did find that name_startsWith and placename_startsWith both work, both produce slightly different results, and I can only find the placename_startsWith in the docs. On the documentation page - http://www.geonames.org/export/web-services.html in the top paragraph is a link to creating an account.
I experimented more with the autocomplete_PLAC function, and can only fall back to my early statement - I remain a long ways away from a deeper understanding.
Do you have any tips for debugging? Perhaps there are some aids already in phpgedview for creating logs in a consistent manner?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did more work on this topic, and now have a patch file to offer. I should have posted this under the bug reports...
Added a "geonames" configuration to the admin page.
Enable/disable, Country-bias (for prioritizing the geonames.org search results), username.
Added the help files and the db updates.
I patterned this after both the google map and the sitename modules, trying to find the right blend of them to leverage from.
There remains a $USE_GEONAMES global configuration, which I think would be unnecessary, however it is woven into several files and I wanted to limit my impact.
Please let me know if there is more I can do to ease the integration of these changes.
David:
Actually, I have been working on this too. I would make the GeoNames database usage configurable on a gedcom-by-gedcom basis, the same way it's done for Google Geocode. You're right that the $USE_GEONAMES variable is no longer required. My code changes remove this.
The reason is that some PhpGedView installations host several different gedcoms, and not everybody might want to employ autocomplete. Also, the GeoNames userid shouldn't be shared between these different gedcoms.
I'll take a close look at your patches this week-end, and merge what you have with what I produced. I'll post a ZIP file with all the changed scripts, so that you can test this. My tests have been inconclusive.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm a long ways from fully understanding the underlying automation, but the autocomplete for addresses was not working for me. When entering city, county, state, country, the drop-down would populate with error hints:
0 Error occurrred on line 536 of file autocomplete.php in function autocomplete_PLAC
1 called from line 91 of file autocomplete.php
As I slipped in some instrumentation code, your line 536 won't match mine.
One of the instrumentation changes I slipped in a few lines above was:
autocomplete.php
From this I could experiment directly with geonames.org, and made a few discoveries, and a nice-to-have:
1. The url $url = "http://ws.geonames.org/searchJSON", can change to the secure form https.
2. They now require a username. The service remains free, and creating an account was trivial. But for PhpGedView, I think we need a configuration option (e.g. accessible via admin.php I suppose). For testing, I hardcoded my username in to my instance of autocomplete.php.
3. "?name_startsWith=" should change to "?placename_startsWith=".
4. I added "&countryBias=USA", so geonames puts those at the top of the list. While creating a new configuration operation (for #1), perhaps this could be slipped in as an option.
My "final" $url looks like this:
And now it doesn't throw errors; and it autocompletes (mostly from my prior entries).
Where did you find the documentation on the current version of the geonames API? A URL would be handy.
The geonames main page - http://www.geonames.org/ has a Documentation link. But I did find that name_startsWith and placename_startsWith both work, both produce slightly different results, and I can only find the placename_startsWith in the docs. On the documentation page - http://www.geonames.org/export/web-services.html in the top paragraph is a link to creating an account.
I experimented more with the autocomplete_PLAC function, and can only fall back to my early statement - I remain a long ways away from a deeper understanding.
Do you have any tips for debugging? Perhaps there are some aids already in phpgedview for creating logs in a consistent manner?
I did more work on this topic, and now have a patch file to offer. I should have posted this under the bug reports...
Added a "geonames" configuration to the admin page.
Enable/disable, Country-bias (for prioritizing the geonames.org search results), username.
Added the help files and the db updates.
I patterned this after both the google map and the sitename modules, trying to find the right blend of them to leverage from.
There remains a $USE_GEONAMES global configuration, which I think would be unnecessary, however it is woven into several files and I wanted to limit my impact.
Please let me know if there is more I can do to ease the integration of these changes.
David:
Actually, I have been working on this too. I would make the GeoNames database usage configurable on a gedcom-by-gedcom basis, the same way it's done for Google Geocode. You're right that the $USE_GEONAMES variable is no longer required. My code changes remove this.
The reason is that some PhpGedView installations host several different gedcoms, and not everybody might want to employ autocomplete. Also, the GeoNames userid shouldn't be shared between these different gedcoms.
I'll take a close look at your patches this week-end, and merge what you have with what I produced. I'll post a ZIP file with all the changed scripts, so that you can test this. My tests have been inconclusive.