Google Static Map path starting from North America although that location is not given in the URL - google-maps-static-api

I have to get a static map with three markers and a path between the markers, I have done this so far,
URL : http://maps.googleapis.com/maps/api/staticmap?maptype=terrain&scale=2&center=-0,0&size=600x600&zoom=1&markers=color:red%7Clabel:A%7C28.37,77.13&markers=color:green%7Clabel:B%7C46.227638,2.213749&markers=color:black%7Clabel:C%7C-40.900557,174.885971&path=color:blue%7Cweight=3%7C20.593684,78.96288%7C46.227638,2.213749%7C-40.900557,174.885971
the path keeps starting from North America although I have not provided it's coordinates anywhere in the URL. Why does this happen and how to rectify this ?

I'm not 100% sure why it's not working for you, but I rearranged the arguments and it seems to work great for me:
http://maps.googleapis.com/maps/api/staticmap?size=600x600&center=0,0&maptype=terrain&scale=2&markers=color:red|label:A|28.37,77.13&markers=color:green|label:B|46.227638,2.213749&markers=color:black|label:C|-40.900557,174.885971&path=color:blue|weight:3|28.37,77.13|46.227638,2.213749|-40.900557,174.885971
You'll have to encode the | character if you're using it in a web app or something that doesn't handle encoding, otherwise a browser(Chrome works for me) should open this just fine.
Hope this works out for you!

Related

How can I actually download/transfer a file found using UPnP?

I'm completely new to UPnP as a protocol, but I'm hoping to use it to transfer files from a Sony Camera to an iOS app I'm working on. So far I have SSDP discovery setup, I can read the UPnP client's services, search through folders and access file names, but the final hurdle which I'm stuck on is how to actually download/transfer the files once I'm able to list them!
What I end up getting is the below:
<item id="04_02_0624600856_000001_000001_000000" restricted="1" parentID="03_01_0624600856_000001_000000_000000">
<dc:title>DSC05076.ARW</dc:title>
<upnp:class>object.item.imageItem.photo</upnp:class>
<dc:date>2018-08-23T12:24:21</dc:date>
<res protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_CI=1">http://192.168.122.1:60151/SM_DSC05076.ARW?%2104%5f02%5f0624600856%5f000001%5f000001%5f000000%21http%2dget%3a%2a%3aimage%2fjpeg%3aDLNA%2eORG%5fPN%3dJPEG%5fSM%3bDLNA%2eORG%5fCI%3d1%21%21%21%21%21</res>
<res protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_LRG;DLNA.ORG_CI=1">http://192.168.122.1:60151/LRG_DSC05076.ARW?%2104%5f02%5f0624600856%5f000001%5f000001%5f000000%21http%2dget%3a%2a%3aimage%2fjpeg%3aDLNA%2eORG%5fPN%3dJPEG%5fLRG%3bDLNA%2eORG%5fCI%3d1%21%21%21%21%21</res>
<res protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN;DLNA.ORG_CI=1">http://192.168.122.1:60151/TN_DSC05076.ARW?%2104%5f02%5f0624600856%5f000001%5f000001%5f000000%21http%2dget%3a%2a%3aimage%2fjpeg%3aDLNA%2eORG%5fPN%3dJPEG%5fTN%3bDLNA%2eORG%5fCI%3d1%21%21%21%21%21</res>
I would (With my naive experience of simple HTTP APIs) then expect to simply be able to download the file in question by hitting:
http://192.168.122.1:60151/SM_DSC05076.ARW or similar (I'm assuming I have to change this URL slightly as the file is listed as image/jpeg rather than RAW?
Whatever combination I try of the full res object, snipping bits, decoding the url e.t.c. I always get a 404 response when trying to visit the URL in question. Is there something more complex I need to do here? Or something simple that I'm missing?
Thanks in advance!
The problem here was that I was using a url from a previous session. It turns out that the urls change between connection sessions, which is why I was getting a 404.
Lesson learned: UPnP is highly dynamic, and you can’t rely on caching images under their access MRL!

How to get road coordinates between two markers google map api

I need to create path exactly according to road coordinates from google map api.I am partially successful with the help of this "http://maps.googleapis.com/maps/api/directions/json?&origin=%#,%#&destination=%#,%#&sensor=false" service.
But this service provide me the coordinates as show in this image .
When we zoom this path it looks like this image .
Actually, I want to get exactly road coordinates with every curve.
Firstly I did this task with the javascript file which was in one of the tutorial of google map (SBMapwithRoute)but don't know why that javascript file stop responding now.
If any body know how this task will perform than please help me.Thank you
I have posted one artical on my blog may be help full check it
http://www.jogendra.com/wayPath
May be hellfull for you
if you wants get waypoints from your google maps waypath. then use this
NSMutableArray *wayPointsArray = [self decodePolyLine:polyline.path.encodedPath];
here decodePolyline is function that you seen on my blog
polyline is object of GMSPolyline *_polyline;
Thnaks

Walking, bicycle and public transport directions with time required in each mode , iPhone

I am using following url to get driving directions between two locations.
NSString* apiUrlStr = [NSString stringWithFormat:#"http://maps.google.com/maps?output=dragdir&saddr=%#&daddr=%#", saddr, daddr];
What changes need to be done in above query to get directions for bicycle, walking or public transport and corresponding distance, time required between two places?
Thanks in advance for any help.
You must use the "dirflg=?" parameter, where "?" can be:
dirflg Route type.
dirflg=h Switches on "Avoid Highways" route finding mode.
dirflg=t Switches on "Avoid Tolls" route finding mode.
dirflg=r Switches on "Public Transit" - only works in some areas. Can also set date and time info described below.
dirflg=w Switches to walking directions - still in beta.
dirflg=b Switches to biking directions - only works in some areas and still in beta.
There are many other params available, read the Google Maps Parameters doc, but of course not all of them are supported by the Maps native API (which is updated at every iOS release). Is up to you to test them as the official Apple doc is not always up to date with all features.

how does the "#" location tag work?

for better understanding check out this link first: http://sxsw.usehipster.com/questions/where-are-the-best-breakfast-tacos-in-austin
as you can see there, some answers have a reference to a location which is show on the map on the right. A user can do that by adding the “#“ symbol before the location name.
I'd like to know how that works. Did the guys from usehipster.com developed that by themselve or is that maybe a framework I can use too?
cheers
Looks custom-made - i.e. not a framework. Shouldn't be too hard - just scan the entry for #\w+, plug that into Google Local Search (possibly specify the city), and plug the output into a Google Map. See e.g. this for an example of Google Local Search API: http://code.google.com/apis/ajax/playground/?exp=localsearch#the_hello_world_of_local_search

iPhone link to map directions using string "current location" not lat and lng for saddr

I know there are numerous questions about how to construct a sharedApplication link to the maps app specifying the start and end address with coordinates. I've got that working no problem.
Has anyone found a way to link with a source address generically specified as "current location".
I ask because the scenario I'm working on having Core Location or a UIMapView would only be necessary in order to determine the user location prior to handing off to the map app where the user locating would seem to just happen again.
I've tried throwing UTF8'd "Current Location" and "[Current Location]" into the saddr parameter which amusingly starts from Current Montana. I've also tried simply excluding the saddr param.
I know this is often tread territory but this particular situation wasn't covered by anything I found searching here or on mapki. Before I add the core location code I just wanted to make sure there wasn't a more limited way to tackle this.
Thanks
This post is quite old, but recently I had to face a similar issue and I developed a solution.
Using "Current Location" (properly escaped) as source address works perfectly.
The downside is that "Current Location" is valid for English language only. If your iPhone is set to use another language, you need to know the exact translation that Apple chose for that particular language.
I wrote a class that can provide the exact translation for "Current Location" in any supported language. You can read my blog post about this.
Hope this helps.