问题
Currently I am generating a Google static map by inserting an address through PHP insertion like this:
<img src="http://maps.googleapis.com/maps/api/staticmap?center=<?=$gmapadd?>&zoom=14&size=300x200&markers=color:blue|label:A|<?=$gmapadd?>&sensor=false">
Now here is an example output from this same script that displays properly:
<img src="http://maps.googleapis.com/maps/api/staticmap?center=11555+Central+Parkway+Jacksonville+FL+32224&zoom=14&size=300x200&markers=color:blue|label:A|11555+Central+Parkway+Jacksonville+FL+32224&sensor=false">
Here however, the output/address breaks the API (doesn't report an error, it just doesn't show the map), but I don't see the formatting problem or why it would break the map display. Also, if I enter this address into Google maps 5000-18 Hwy 17 #82 Orange Park, FL 32003
it does recognize it and display properly?
<img src="http://maps.googleapis.com/maps/api/staticmap?center=5000-18+Hwy+17+#82+Orange+Park+FL+32003&zoom=14&size=300x200&markers=color:blue|label:A|5000-18+Hwy+17+#82+Orange+Park+FL+32003&sensor=false">
回答1:
The "#" is not legal in a URL. It needs to be encoded:
http://maps.googleapis.com/maps/api/staticmap?center=5000-18%2BHwy%2B17%2B%2382%2BOrange%2BPark%2BFL%2B32003&zoom=14&size=300x200&markers=color:blue|label:A|5000-18%2BHwy%2B17%2B%2382%2BOrange%2BPark%2BFL%2B32003&sensor=false
来源:https://stackoverflow.com/questions/16321218/address-breaks-map-display-why