• Hi all,

    I am working to improve a website and replace Google Map system.
    So I am trying to display the map related directly to addresses, in my file PHP, as seen below :

    <?php
    	        // on fait de $post une variable globale
    			global $post;
    
    			// on stocke la variable dans un nom de variable inutilisé
    			$book_post_ID = $post->ID;
    			$rue_post_ID = get_post_meta( $book_post_ID, 'cp_street', true );
    			$codepostal_post_ID = get_post_meta( $book_post_ID, 'cp_zipcode', true );
    			$ville_post_ID = get_post_meta( $book_post_ID, 'cp_city', true );
    			$pays_post_ID = get_post_meta( $post->ID, 'cp_country', true );
    
    			// enfin, on fait appel au shortcode de l'extension "Leaflet Map"
    			echo do_shortcode("[leaflet-map address='". $rue_post_ID ." ". $codepostal_post_ID ." ". $ville_post_ID ." ". $pays_post_ID ."' zoom=17]");
    		?>

    Most of the time, it works, but some address will not load, and default coordinates appear instead.

    How can I correct this, and make it work pemanently? Should I try another free system / API / anything else, and how ?
    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author bozdoz

    (@bozdoz)

    Which addresses won’t load? Sounds like Nominatum can’t find the addresses. Try them out here to double check: https://nominatim.openstreetmap.org/

    Thread Starter s13pn

    (@s13pn)

    Indeed, some addresses can’t be found (“lotissement le Château Loubassane 13090 Aix en Provence France” for instance).

    But others can’t be found with shortcode, BUT works with the link you provide (“rue de l’encyclopedie 93210 saint denis France”) ?!

    Plugin Author bozdoz

    (@bozdoz)

    Maybe try echo-ing the address passed to the shortcode. It is using nominatum in the background, so I have to believe there should be no difference.

    Thread Starter s13pn

    (@s13pn)

    No difference…
    Some addresses are just not found, as soon as the street is mentionned.

    In order to display positively (100%) addresses, I have to mention very only zip-code and city.

    Plugin Author bozdoz

    (@bozdoz)

    You might want to clear the cache also; go into the leaflet map admin settings; there should be a button to clear address caches. Maybe it failed once and is always failing, even though it shouldn’t? Not sure otherwise. It should be using the same lookups as nominatum itself. You could alternatively set up Google Maps API to use their geocoder. The plugin works by looking up the address once, then saving the locations to the database (that’s why the clear cache button might work). Hope that helps.

    Thread Starter s13pn

    (@s13pn)

    I cleared the cache before every try, cleared browser too (to start again with a clean sheet) but nothing worked for some addresses. : /

    Maybe a place not added by contributors ?! I don’t know at all..

    Whatever, I finally came back to Google at the moment… works obviously great but..!

    Thanks for your help.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Some address not loading / displaying’ is closed to new replies.