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, 4 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #415616

    directoryfan
    Expired Member
    Post count: 157

    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
    Marius

    #415624

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
    #415748

    directoryfan
    Expired Member
    Post count: 157

    5. 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?

    #415761

    directoryfan
    Expired Member
    Post count: 157

    Hi 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.

    #415762

    directoryfan
    Expired Member
    Post count: 157
    This reply has been marked as private.
    #417391

    directoryfan
    Expired Member
    Post count: 157

    Hello 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

    #417400

    Alex Rollin
    Moderator
    Post count: 27815

    Hello Marius,

    can you be more specific about the issue? I don’t understand it right now.

    #417582

    directoryfan
    Expired Member
    Post count: 157

    Hello 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.

    #417595

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    please provide wp-admin and FTP details and i will take a look.

    Thanks,

    Stiofan

    #417690

    directoryfan
    Expired Member
    Post count: 157
    This reply has been marked as private.
    #417748

    Stiofan O’Connor
    Site Admin
    Post count: 22956
    This reply has been marked as private.
    #417760

    directoryfan
    Expired Member
    Post count: 157
    This reply has been marked as private.
    #417767

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    i 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"
    #417777

    directoryfan
    Expired Member
    Post count: 157

    Hi 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.) ?

    #417800

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    If 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

Viewing 15 posts - 1 through 15 (of 30 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount