AyeCode / geodirectory

GeoDirectory is the leading Directory Plugin for WordPress. Compatible with Gutenberg and the most popular page builders such as Elementor, Oxygen, Beaver Builder and Divi. GeoDirectory is the only solution for WordPress that can scale to millions of listings and high traffic.
https://wpgeodirectory.com/
Other
41 stars 22 forks source link

OpenStreetMap autocomplete address search with country wise address format #1063

Open kprajapatii opened 4 years ago

kprajapatii commented 4 years ago

See https://wpgeodirectory.com/support/topic/openstreetmaps-auto-fill-selects-county-field-for-the-city-and-saves-it-as-city/#post-529948

alexrollin commented 4 years ago

OSM has all the data available in pieces. Member asks if it is possible to have some kind of template system to put the parts in the correct order.

This is a very common request from Germ members who are adamant about formatting the address the German way.

kprajapatii commented 4 years ago

Example:

AddressFormats = [{
    format: [
        ["housenumber", "street"],
        ["city", "postcode"]
    ]
}, {
    countryCodes: ["au"],
    format: [
        ["unit", "housenumber", "street"],
        ["suburb", "state", "postcode"]
    ]
}, {
    countryCodes: ["gb"],
    format: [
        ["housename"],
        ["housenumber", "street"],
        ["city", "postcode"]
    ]
}, {
    countryCodes: ["ie"],
    format: [
        ["housename"],
        ["housenumber", "street"],
        ["city"],
        ["postcode"]
    ]
}, {
    countryCodes: ["at", "ch", "de", "si", "pl"],
    format: [
        ["street", "housenumber"],
        ["postcode", "city"]
    ]
}, {
    countryCodes: ["ad", "ba", "be", "cz", "dk", "es", "fi", "gr", "hr", "is", "it", "li", "nl", "no", "pt", "se", "sk", "sm", "va"],
    format: [
        ["street", "housenumber", "unit"],
        ["postcode", "city"]
    ]
}, {
    countryCodes: ["fr", "lu", "mo"],
    format: [
        ["housenumber", "street"],
        ["postcode", "city"]
    ]
}, {
    countryCodes: ["br"],
    format: [
        ["street"],
        ["housenumber", "suburb"],
        ["city", "postcode"]
    ]
}, {
    countryCodes: ["vn"],
    format: [
        ["housenumber", "street"],
        ["subdistrict"],
        ["district"],
        ["city"],
        ["province", "postcode"]
    ]
}, {
    countryCodes: ["ca"],
    format: [
        ["housenumber", "street", "unit"],
        ["city", "province", "postcode"]
    ]
}, {
    countryCodes: ["us"],
    format: [
        ["housenumber", "street", "unit"],
        ["city", "state", "postcode"]
    ]
}, {
    countryCodes: ["tw"],
    format: [
        ["postcode", "city", "district"],
        ["place", "street"],
        ["housenumber", "floor", "unit"]
    ]
}, {
    countryCodes: ["jp"],
    format: [
        ["postcode", "province", "county"],
        ["city", "suburb"],
        ["quarter", "neighbourhood"],
        ["block_number", "housenumber"]
    ]
}, {
    countryCodes: ["tr"],
    format: [
        ["neighbourhood"],
        ["street", "housenumber"],
        ["postcode", "district", "city"]
    ]
}, {
    countryCodes: ["ua"],
    format: [
        ["housenumber", "postcode"],
        ["street"]
    ]
}, {
    countryCodes: ["cn"],
    format: [
        ["postcode", "province"],
        ["city", "district"],
        ["street", "housenumber"]
    ]
}, {
    countryCodes: ["bo"],
    format: [
        ["street", "housenumber"],
        ["neighbourhood", "city"]
    ]
}, {
    countryCodes: ["pe"],
    format: [
        ["street", "housenumber"],
        ["neighbourhood"],
        ["city", "state", "postcode"]
    ]
}];
gitmari commented 4 years ago

Hi @alexrollin , hi @kprajapatii and thank you for considering this!

In the above code:

{ countryCodes: ["at", "ch", "de", "si", "pl"], format: [ ["street", "housenumber"], ["postcode", "city"] ] }

this street format is the format of more countries. Is this code part of GD or it has to be implemented? Thank you a lot for taking this in consideration!

Greetings, Marius

alexrollin commented 2 years ago

Several customers have reported that they wish to have better integration with the maps APIs regarding specific address formats in use in their countries.

In these countries 'all addresses are always formatted a specific way with specific data in a specific order'

While it may be possible for some site admins to re-arrrange house number to be last in the street field, other admins with huge sites want the data that comes from the api to be formatted in the correct order/format, without requiring users or site admins to correct it.

Wehave had many many tickets from german members with this request and now from France. These requests are not the same, though. While DE needs housenumber in a different order, france needs the 'departement' data, similar to 'county' in the USA.

https://secure.helpscout.net/conversation/1856311005/31501/

For german task - they also want to change the order of the field input. In the address part of the add listing form, they want the zip code to be first, and then city, then region and then country.

Ticket ID: https://secure.helpscout.net/conversation/1830724606/30759?folderId=3844502