Search code examples
google-mapsblackberrygoogle-maps-api-3blackberry-simulatorhttpconnection

Google static maps - Weird/contrasting behavior on BlackBerry simulator and PC Browser


I am stuck with a weird problem. I am trying to download a Google Static maps image by executing a simple URL in my application, but the image seems to be very different from what i see on my PC browser.

The catch is that I am trying to display the driving directions between 2 lat/long points using overview polyline points (obtained using Google Maps Direction Api). As expected the overview_polyline points are large and contain a lot of special characters..like below

overview_polyline: { levels: "B@@@@@@@@@@@@@@@@@A@@@@@@@@A@@@@@@@@A@@@@A@@@A@@@@@@@@@@@@@A@@@@@@@@@@@@@@A@@A@@@@@@@@@@@@@@@@@@A@@@@@@@@@@@@@@A@@A@@@@@@A@@@@@@A@@@@@@@B" points: "sfdnAunkxMAk[yKiKdbAhn@pPzZbMns@tr@tjAvKbb@ru@zq@rMl{@leAhsAKpUhu@ps@bMzDdXheAzZzXd\|k@~ZnUdYzb@jmA|s@~UrYxe@lRj~@px@|qAzf@fb@d_@c@~QfrAjThBvhAtMc@nSdWpC~[|k@tp@jr@dd@bd@deAjV~SvKffBtI~[~u@zt@tMn^heAfh@h[fj@~XzVpWjnAxSlTeIro@tEvNzP|JvTgDbl@zBdfAdyAbe@baApg@hc@fJr]tb@vf@fPdElQ|Ulc@YzLpUvtApq@f_@xGHnZwHpb@|Qde@tIdj@gAv\dYngAFnAtOhp@|^jlDvf@pdAhKns@dv@|tApHn@xVj@vBfxCnLpPlBjGtlA}Ala@||Afo@nfB|Epi@faCftFtHl@q@vg@_In^jJ``BpHlUf_ApcA|c@dz@bKbfDjjAfkCv@dzA~x@lrBpCx\jJlVpNhuBhHhYtQzc@|[Xtu@byA|p@bz@Z|n@xu@p_@xNnRfo@vc@bSzZhJjc@w@|m@ru@{@jCda@jInSpmApk@s@dp@{Hpl@pDnRhn@nO~uAC`_@zJ|hAoBpd@~L|WzRxeARmDva@hKxPv@lVj]pCvA~Cvg@~@z@nHxa@yAboAxKnUyFjh@w]nk@uMfXlErRuCUsE" }


Will it be a problem to use this on BlackBerry, does it have any side-effect when excuted using httpconnection. I am suspecting a User-Agent issue, but not sure..

Here's the url i am trying to download - Direction from New York to New Jersey

http://maps.googleapis.com/maps/api/staticmap...


Solution

  • I don't think this is a blackberry thing. I was having the same issue and it actually was because the polyline most likely has some characters that need to be escaped before creating a url. You can do it in ruby with URI.escape(string) or just google for a utility that you prefer to do it for you. I see that Scott W. above already posted this so I voted it up, but maybe you are waiting for it to pop up as an answer.