Serg-Norseman / GEDKeeper

GEDKeeper - program for work with personal genealogical database
https://gedkeeper.net/
GNU General Public License v3.0
157 stars 44 forks source link

Problems in Geocoders #262

Closed m-kosina closed 3 years ago

m-kosina commented 4 years ago

I have some problems with all geocoders. Here is my summary:

1) Google not working - REQUEST_DENIED - see: 2020-06-25_21-11-35

2) Yandex not working - Forbidden - see: 2020-06-25_21-12-57

3) OSM partially works - as it works only for the full exact address - but it is for example not able to find Praha - the capital of the Czech Republic :(. OSM return following xmlDocument : <?xml version="1.0" encoding="UTF-8"?><searchresults timestamp="Thu, 25 Jun 20 19:14:44 +0000" attribution="Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright" querystring="Praha" exclude_place_ids="235543162,235518875,235530751,235760326,366688,39848289,18958403,77094116,348481,281955901" more_url="https://nominatim.openstreetmap.org/search.php?q=Praha&amp;exclude_place_ids=235543162%2C235518875%2C235530751%2C235760326%2C366688%2C39848289%2C18958403%2C77094116%2C348481%2C281955901&amp;format=xml"><place place_id="235543162" osm_type="relation" osm_id="439840" place_rank="16" boundingbox="49.9419006,50.1774301,14.2244355,14.7067867" lat="50.0874654" lon="14.4212535" display_name="Prague, okres Hlavní město Praha, Hlavní město Praha, Prague, Czech Republic" class="boundary" type="administrative" importance="0.84349146327875" icon="https://nominatim.openstreetmap.org/images/mapicons/poi_boundary_administrative.p.20.png" /><place place_id="235518875" osm_type="relation" osm_id="2273264" place_rank="20" boundingbox="48.3473476,48.3944648,19.4720826,19.5218005" lat="48.3633004" lon="19.5083739" display_name="Praha, District of Lučenec, Region of Banská Bystrica, Central Slovakia, Slovakia" class="boundary" type="administrative" importance="0.587795016854" icon="https://nominatim.openstreetmap.org/images/mapicons/poi_boundary_administrative.p.20.png" /><place place_id="235530751" osm_type="relation" osm_id="435541" place_rank="8" boundingbox="49.9419006,50.1774301,14.2244355,14.7067867" lat="50.0596288" lon="14.446459273258009" display_name="Prague, Czech Republic" class="boundary" type="administrative" importance="0.55" icon="https://nominatim.openstreetmap.org/images/mapicons/poi_boundary_administrative.p.20.png" /><place place_id="235760326" osm_type="relation" osm_id="2273338" place_rank="18" boundingbox="48.3473476,48.3944648,19.4720826,19.5218005" lat="48.37088145" lon="19.497386962391367" display_name="Praha, District of Lučenec, Region of Banská Bystrica, Central Slovakia, Slovakia" class="boundary" type="administrative" importance="0.41" icon="https://nominatim.openstreetmap.org/images/mapicons/poi_boundary_administrative.p.20.png" /><place place_id="366688" osm_type="node" osm_id="151332250" place_rank="20" boundingbox="29.648289,29.688289,-97.0872073,-97.0472073" lat="29.668289" lon="-97.0672073" display_name="Praha, Fayette County, Texas, United States of America" class="place" type="hamlet" importance="0.36" icon="https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png" /><place place_id="39848289" osm_type="node" osm_id="3009662515" place_rank="20" boundingbox="52.8262759,52.8662759,23.5440979,23.5840979" lat="52.8462759" lon="23.5640979" display_name="Praha, Łosinka, gmina Narew, Hajnówka County, Podlaskie Voivodeship, Poland" class="place" type="hamlet" importance="0.36" icon="https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png" /><place place_id="18958403" osm_type="node" osm_id="1870051840" place_rank="18" boundingbox="49.6592831,49.6593831,13.8190089,13.8191089" lat="49.6593331" lon="13.8190589" display_name="Praha, Nepomuk, okres Příbram, Středočeský kraj, Central Bohemia, 26243, Czech Republic" class="natural" type="peak" importance="0.34181178765026" icon="https://nominatim.openstreetmap.org/images/mapicons/poi_peak.p.20.png" /><place place_id="77094116" osm_type="node" osm_id="6770973484" place_rank="30" boundingbox="60.1695366,60.1696366,24.9403173,24.9404173" lat="60.1695866" lon="24.9403673" display_name="Praha, Mannerheimintie, City center, Kluuvi, Southern major district, Helsinki, Helsinki sub-region, Uusimaa, Mainland Finland, 00100, Finland" class="amenity" type="bar" importance="0.111" icon="https://nominatim.openstreetmap.org/images/mapicons/food_bar.p.20.png" /><place place_id="348481" osm_type="node" osm_id="139584970" place_rank="30" boundingbox="61.4991391,61.4992391,23.7800368,23.7801368" lat="61.4991891" lon="23.7800868" display_name="Praha, Itsenäisyydenkatu, Pihlajapiha, Tulli, Tampere, Tampereen seutukunta, Pirkanmaa, Mainland Finland, FI-33500, Finland" class="amenity" type="pub" importance="0.111" icon="https://nominatim.openstreetmap.org/images/mapicons/food_pub.p.20.png" /><place place_id="281955901" osm_type="node" osm_id="7344319733" place_rank="30" boundingbox="48.362917,48.363017,19.5084099,19.5085099" lat="48.362967" lon="19.5084599" display_name="Praha, 2662, Praha, District of Lučenec, Region of Banská Bystrica, Central Slovakia, 985 11, Slovakia" class="tourism" type="information" importance="0.111" icon="https://nominatim.openstreetmap.org/images/mapicons/amenity_information.p.20.png" /></searchresults> so the test from the ParseXML method Node.Attributes["class"].InnerText == "place" fails for all returned data and nothing is displayed. Temporarily I modify the source to display "[" + xNode.Attributes["class"].InnerText + ": " + xNode.Attributes["type"].InnerText + "] " at the begining, so I'm able to select myself - see 2020-06-25_21-33-06

Akeloya commented 4 years ago

I think there should be some web browser with predefined, editable settings contained links to public maps. So geocoder will be on javascript API of Google maps, OSM and Yandex.

For example - Yandex allow you to encode limited count coordinates in day for free, if you want more - pay money. I think, other map provider has the same politics.

Serg-Norseman commented 4 years ago

Some time ago, Google informed me about the bad use of my API key and warned about the financial consequences. I deactivated the key.

Yandex and OSM - I need to understand. I don’t know what is the reason.

All forms of the program can be replaceable in plugins. Any developer can develop their own implementation of any dialogue in the plugin and thus replace the standard one. Therefore, you can make a version based on the browser.

The reason why it is done the way it is now, because for my personal goals I needed a custom implementation of map output and a separate simplified geocoder functionality, independent of any third-party implementations.

There is a secondary reason for this implementation: most developers of .NET libraries for displaying maps in a browser (by the way, this was originally an implementation) or for supporting multi-geo-coding from different sources do not support legacy .NET versions. Only new versions of the language and framework. Legacy is not for them. But this approach does not suit me. I need a library / framework that is compatible with old .NET and old Windows. I already lost several important users for me when the program stopped working on very old versions of Windows (2000 or lower), this happened after I ported the program to .NET. This is the reason why sometimes I seriously think about switching to C++ - for independence from wobbling frameworks and the OS.

Serg-Norseman commented 4 years ago

When implemented on a browser basis, Google does not allow its services if a standard WebBrowser component is used. Because there is a screwed-up Microsoft engine inside that they stopped supporting. From the history of project commits, it is easy to find out when there was a browser implementation that was replaced with the current one.

m-kosina commented 4 years ago

I understand the problem with Google. OSM is imo ok, it should be great if:

  1. if there is no Node.Attributes["class"].InnerText == "place" (exact place), GEdKeeper should display also Node.Attributes["class"].InnerText == "boundary" (town, village, or other area) with information about area type ( xNode.Attributes["type"].InnerText )

  2. I dont know, if it is possible in OSM, but it would be great to be able to restrict search only to some state (so it will not search for Czech capital town in US)

m-kosina commented 4 years ago

Commenting my post above:

  1. for me following works correctly and as I suppose: 2020-06-26_13-17-10

  2. jfyi it is possible to add list of countries into query string - https://nominatim.org/release-docs/develop/api/Search/ Result limitation countrycodes=[,][,]... Limit search results to one or more countries. must be the ISO 3166-1alpha2 code, e.g. gb for the United Kingdom, de for Germany. , which (minimally for me :) ) improve returned data a lot! I added private const string REQUEST_URL = "http://nominatim.openstreetmap.org/search.php?q={0}&format=xml&accept-language={1}&countrycodes=cz"; but there can be a list of country codes there - and it would be great to have this configurable for users imo

And this results into 2020-06-26_13-19-31 (compare it to no data as initial state and screenshot from the first comment when display all countries)