I am using Google Maps static interface to show maps in my web application. I am using address to pinpoint place (example: Street name, Post-code City, Country), using PHP to generate maps embed URL. This works great but sometimes some addresses return multiple results and maps drop multiple PINs (Place A, B, C, etc…) at the same address!
Example 1: address is one place -> everything is OK, marker is displayed with place address
http://maps.google.com/maps?q=Skrita+ulica+5,+2000+Maribor,+Slovenija+(OAZA MIRU)&f=q&source=s_q&hl=sl&ie=UTF8&z=15&t=m&iwloc=addr&output=embed
Example 2: address returns multiple places and marker with place name does not show
http://maps.google.com/maps?q=Ulica+Eve+Lovše+1,+2000+Maribor,+Slovenija+(Restavracija+in+Pizzeria+%22MISTERIUM%22+Mercator+Center+)&f=q&source=s_q&hl=sl&ie=UTF8&z=15&t=m&iwloc=addr&output=embed
Is there a possibility to auto select for-example the first place on the matched address and show a marker like in Example 1?
The
numparameter determines how many results to show. Addnum=1to the URL to restrict the results to just one. Reference. (You can even specifynum=0but that seems a bit pointless)NB: If the URL returns more than one result, it’s because the search algorithm can’t be certain of the right result based on your
q=string. Restricting the output to just the first one may not produce the result you want.