How to specify an address in a Google Maps Directions API URL -
how specify address in google maps web services directions api url? maps web services page states
converting url receive user input tricky. example, user may enter address "5th&main st." generally, should construct url parts, treating user input literal characters.
however isn't clear. there no examples , haven't been able find on web. mean that, given example, "5th&main st." following valid?
https://maps.googleapis.com/maps/api/directions/json?destination=5th%26main+st.&sensor=true
if not, correct conversion?
thanks reading.
as per understanding, looking uri encode
.
in javascript:
encodeuri
used encode string special characters including foreign language.
example:
var address = "5th&main st."; var encodedaddress = encodeuri(address);
then pass encodedaddress in google maps api.
https://maps.googleapis.com/maps/api/directions/json?destination=encodedaddress&sensor=true
a small list of symbol equivalent encoding (percent encoding):
space %20 ! %21 " %22 # %23 $ %24 % %25 & %26 // happended in case ' %27 ( %28 ) %29
once faced issue, whild doing geocoding via c#
.
where did similar uri encoding using httputility.urlencode()
address , passed google api mentioned in above. each language has own encoding technique, yet output same.
hope understand.
Comments
Post a Comment