Outils pour utilisateurs

Outils du site


informatique:wordpress:acf:acf-openstreetmap-field

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
informatique:wordpress:acf:acf-openstreetmap-field [24/12/2024 11:11] – [Surcharge de la Localisation du résultat] cyrilleinformatique:wordpress:acf:acf-openstreetmap-field [25/12/2024 21:56] (Version actuelle) – [different geocoders] cyrille
Ligne 12: Ligne 12:
  
   * [[https://github.com/mcguffin/acf-openstreetmap-field/issues/71|Other library nominatim to geocoder]]   * [[https://github.com/mcguffin/acf-openstreetmap-field/issues/71|Other library nominatim to geocoder]]
 +
 +Étude ...
 +<code javascript>
 +// 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()
 +
 +</code>
 +
 +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 ==== ==== Surcharge de la Localisation du résultat ====
  
-In ''‎include/ACFFieldOpenstreetmap/Core/Core.php''+  * Issue https://github.com/mcguffin/acf-openstreetmap-field/issues/128 
 +  * PR https://github.com/mcguffin/acf-openstreetmap-field/pull/129
  
-Override geocode results format translation in wp-config+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. Geocode results format are set with translation for localisation. But in some case we want specific formats.
Ligne 28: Ligne 55:
 define('ACF_OSM_I18N_ADDR_COUNTRY',''); define('ACF_OSM_I18N_ADDR_COUNTRY','');
 </code> </code>
 +
 +Or with a filter in ''functions.php'' or somewhere else :
  
 <code php> <code php>
-'address_format=> [ +add_filter('acf_osm_address_format', function($format){ 
- 'street' => defined('ACF_OSM_I18N_ADDR_STREET'+ $format['street'= 'from filter: {building} {road} {house_number}' ; 
-   ? constant('ACF_OSM_I18N_ADDR_STREET'+ return $format ; 
-   __( '{building} {road} {house_number}' +} );
-   , 'acf-openstreetmap-field' ), +
- 'city' => defined('ACF_OSM_I18N_ADDR_CITY'+
-   ? constant('ACF_OSM_I18N_ADDR_CITY'+
-   : __( '{postcode{city} {town} {village} {hamlet}' +
-   , 'acf-openstreetmap-field' )+
- 'country' => defined('ACF_OSM_I18N_ADDR_COUNTRY'+
-   ? constant('ACF_OSM_I18N_ADDR_COUNTRY'+
-   : __( '{state} {country}' +
-   , 'acf-openstreetmap-field' )   +
-]+
 </code> </code>
 +
 +==== 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]]
 +
 +
  
informatique/wordpress/acf/acf-openstreetmap-field.1735035074.txt.gz · Dernière modification : 24/12/2024 11:11 de cyrille

Sauf mention contraire, le contenu de ce wiki est placé sous les termes de la licence suivante : CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki