Understanding OpenStreetMap, auto-fill API and saving cities (locationss)
This topic contains 29 replies, has 4 voices, and was last updated by directoryfan 6 years, 5 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: auto fill, OpenStreetMap API
-
AuthorPosts
-
February 2, 2018 at 12:37 pm #415616
Hello Support Team,
when using the OpenStreetMap API after entering the address of a listing, the auto-fill feature of the API will suggest the whole Adress eg. :
searching for: ‘Messingstraße 10′
will suggest: ’10, Messingstraße, Legelshurst, Willstätt, Ortenaukreis, Regierungsbezirk Freiburg, Baden-Würrtemberg, 77731 Germany’
or ‘street nr, street, village, municipality(rural city), rural district, governmental district, state, postcode country’
but after selecting the suggestion, the address field will be filled with ’10, Messingstraße, Legelshurst, Willstätt’ and the city field with ‘Regierungsbezirk Freiburg’, which is wrong, this is not a city, it is a governmental district. In my opinion, the city field should be filled with the municipality(rural city) so with ‘Willstätt’. The same happens to other villages too. So, there will be for all the villages in that governmental district, just a location saved, the governmental district as the city. When I try to change the city manually
More information(graphics) about district divisions of Germany: in English, in German. And about German cities: rural and urban cities in Germany
In this case, I have some questions:
1. How can I manipulate the auto-complete function of the API, in order to select a customized address for the address field? So instead of ’10, Messingstraße, Legelshurst, Willstätt’ to have just ‘Messingstraße 10’ as the German norm for the address.
2. How can I select the right value from the API response, in order to select the right location, so instead of ‘Regierungsbezirk Freiburg’ just ‘Willstätt’ as the German norm for the rural city/municipality?
3. When I try to change manually the city from the wrong auto-filled governmental district to the rural city ‘Willstätt’, on saving the value will be automatically changed back to ‘Regierungsbezirk Freiburg’. So, I can not change it, how can I?
4. When setting the location on the map over the Location Manager or over the listing form, we get different decimal places for the longitude. Can I change somewhere an option to have them with the same decimal places?
Thank you a lot for your time and help
MariusFebruary 2, 2018 at 1:11 pm #415624This reply has been marked as private.February 3, 2018 at 11:42 am #4157485. What do I have to consider, when starting a project with Google Maps API and afterward changing to the OSM API? (started this in a different thread). Is this a good idea at all, does GeoDirectory handle the change without extra maintenance by developers/project owners?
February 3, 2018 at 12:44 pm #415761Hi Alex, I started with OSM, but as for now, there are just some locations and listings in the DB. Because the website is of a non-profit organization and just for a single business branch like kundalini yoga and not a business with a lot of financial win :), I think, maybe I will go with OSM and thank you for your information in the other thread.
At least I have to find more information about the usage limits of Google Maps API for non-profit organizations. I found the exceptions for the usage limit and how to apply as a non-profit organization. Because we will have otherwise costs, since the old website has a good Google position in the whole German state Baden-Württemberg and since each visitor will load at least 10 times the google maps, just through accessing the homepage, a search and opening some detail sites of the listings. I have first to clarify with the community and with Google about this decision.
I’m happy to hear, as you mentioned in the other thread, that if I’ll start with OSM I’ll have maybe some locations to merge or correct (CSV bulk geocoding) after all. This is cool, that GeoDirectory gives me this flexibility.
February 3, 2018 at 12:47 pm #415762This reply has been marked as private.February 13, 2018 at 1:53 pm #417391Hello Support Team,
do you have an idea on how can I find a solution for the second and third question. Since I can not change afterwards the location and the location/city selection from the OSM API is wrong for smaller and urban cities, I do have a problem and I do not know how to fix it.
Greetings, Marius
February 13, 2018 at 3:03 pm #417400Hello Marius,
can you be more specific about the issue? I don’t understand it right now.
February 14, 2018 at 3:30 pm #417582Hello Alex,
in my opinion, when adding a new listing the selected location from the OSM API for the field City is wrong. When the address is a village or even a village nearby and part of a bigger city, the suggested city is in a lot of cases the governmental district of the state, which is wrong. And the user cannot change manually the city, since OSM will replace it with the false one.
My Project is a local one, just for the state Baden-Württemberg, Germany. And keep in mind the format of the OSM answer: ‘street nr, street, village, municipality(rural city), rural district, governmental district, state, postcode country’
Example 1: village near big city Lahr
searching for: ‘Luisenstraße 5, Kippenheimweiler′
OSM will suggest the address: ’5, Luisenstraße, Kippenheimweiler, Verwaltungsgemeinschaft Lahr/Schwarzwald’
and the autofill value for the City field: ‘Regierungsbezirk Freiburg′
it should be: ‘Lahr′Example 2: normal village
searching for: ‘Unditzstraße 6, Schutterzell′
OSM will suggest the address: ’6, Unditzstraße, Schutterzell, Ottenweier Hof, Neuried’
and the autofill value for the City field: ‘Regierungsbezirk Freiburg′
it should be: ‘Neuried′So the suggestion is wrong, ‘Regierungsbezirk Freiburg′ is not a city/location it is a governmental district of the state with hundreds of cities/locations.
a. Can you confirm the bug?
b. Where and how can I change the call to the OSM-API? I need the files and some links to the docs for the calling params. I’ll try to work together with the German OSM community too.February 14, 2018 at 4:50 pm #417595please provide wp-admin and FTP details and i will take a look.
Thanks,
Stiofan
February 15, 2018 at 7:37 am #417690This reply has been marked as private.February 15, 2018 at 12:00 pm #417748This reply has been marked as private.February 15, 2018 at 12:40 pm #417760This reply has been marked as private.February 15, 2018 at 1:29 pm #417767i added the fix to your site above that fixes #2.
The suggested address does contain that part but there is no way for me to be able to reliably know what part of that string is a city/town.
The api return for the #2 is below:
country : "Germany" country_code : "de" county : "Ortenaukreis" house_number : "6" postcode : "77743" residential : "Schutterzell" road : "Unditzstraße" state : "Baden-Württemberg" state_district : "Regierungsbezirk Freiburg" suburb : "Ottenweier Hof" village : "Neuried"
February 15, 2018 at 2:58 pm #417777Hi Stiofan, this is working now much better. The most of the cases are now OK.
As for
example 1: village near big city Lahr/Schwarzwald, which is actually a suburb of the city
searching for: ‘Luisenstraße 5, Kippenheimweiler′
OSM will suggest the address: ’5, Luisenstraße, Kippenheimweiler, Verwaltungsgemeinschaft Lahr/Schwarzwald’
and the autofill value for the City field: ‘Regierungsbezirk Freiburg′
it should be: ‘Lahr/Schwarzwald′The suggested address does contain that part but there is no way for me to be able to reliably know what part of that string is a city/town.
1. I cannot see in the API return for #1 the field with the value ‘Verwaltungsgemeinschaft Lahr/Schwarzwald’. It is the city_district ?
2. Do you have a link to the OSM API docs for address autocomplete? Or do you have a list with all the name of the returned fields (state, state_district, etc.) ?
February 15, 2018 at 6:29 pm #417800If you know how to use the chrome inspector you can see the return in the “network” tab.
The Lahr/Schwarzwald is just on one big line address, not split into sections so its impossible to grab the right info.
Stiofan
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket