====== acf-openstreetmap-field ====== * https://github.com/mcguffin/acf-openstreetmap-field Un plugin ACF pour intégrer une carte à partir d'OpenStreetMap et Leaflet. ===== Proposed changes ===== ==== different geocoders ==== The plugin already use [[https://github.com/perliedman/leaflet-control-geocoder|leaflet-control-geocoder]] so it miss the UI, decoding and storing stuff * [[https://github.com/mcguffin/acf-openstreetmap-field/issues/71|Other library nominatim to geocoder]] Étude ... // plugin view // in wp-content/plugins/acf-openstreetmap-field/src/js/lib/media/views/map-input.js initGeocode() { geocoder_options = Object.assign({ ... geocoder: L.Control.Geocoder.nominatim( nominatim_options ) this.geocoder = L.Control.geocoder( geocoder_options ) // tests // in wp-content/plugins/acf-openstreetmap-field/test/js/address.js mapDrawCenter(){ const geocoder = L.Control.Geocoder.nominatim() Les geocoders de [[https://github.com/perliedman/leaflet-control-geocoder|leaflet-control-geocoder]] n'ont pas tous l'option ''htmlTemplate'' :-( * [[https://www.liedman.net/leaflet-control-geocoder/docs/interfaces/geocoders.NominatimOptions.html#htmltemplate|Nominatim htmlTemplate]] * [[https://www.liedman.net/leaflet-control-geocoder/docs/interfaces/geocoders.PhotonOptions.html#htmltemplate|Photon htmlTemplate]] Geocoder options * [[https://www.liedman.net/leaflet-control-geocoder/docs/classes/geocoders.Openrouteservice.html#options|Openrouteservice options]] * [[https://www.liedman.net/leaflet-control-geocoder/docs/interfaces/geocoders.PeliasOptions.html|PeliasOptions]] * [[https://www.liedman.net/leaflet-control-geocoder/docs/interfaces/geocoders.OpenCageOptions.html|OpenCageOptions]] ==== Surcharge de la Localisation du résultat ==== * Issue https://github.com/mcguffin/acf-openstreetmap-field/issues/128 * PR https://github.com/mcguffin/acf-openstreetmap-field/pull/129 In ''‎include/ACFFieldOpenstreetmap/Core/Core.php'' override geocode results format translation with ''constants in wp-config.php'' or with ''acf_osm_address_format'' WP filter. Geocode results format are set with translation for localisation. But in some case we want specific formats. In ''wp-config.php'' we can override the 3 formats for the address like: define('ACF_OSM_I18N_ADDR_STREET','{building} {house_number} {road}'); define('ACF_OSM_I18N_ADDR_CITY','{village} {town} {city}'); define('ACF_OSM_I18N_ADDR_COUNTRY',''); Or with a filter in ''functions.php'' or somewhere else : add_filter('acf_osm_address_format', function($format){ $format['street'] = 'from filter: {building} {road} {house_number}' ; return $format ; } ); ==== Set map view with zoom after geocoding ==== * https://github.com/mcguffin/acf-openstreetmap-field/issues/122 * @mcguffin closed this as completed in [[https://github.com/mcguffin/acf-openstreetmap-field/commit/648a42a86fb26bf216fdc7d2552bffbf8fcfa477|648a42a]]