Nick + Jason,
thanks very much for the information,
did a small proof of concept and it looks like injecting HTML with javascript
into a uiwebview is the way forward, a real rough example but it works, I have
a couple of more functions to provide e.g. without the lat and long but search
criteria, then a good tidy up.
private string buildFromLatLng(string lat, string lng) {
string speechmark = ((char)(34)).ToString();
StringBuilder buildHTML = new StringBuilder();
buildHTML.AppendLine("<!DOCTYPE html>");
buildHTML.AppendLine("<html
xmlns=%%1%%http://www.w3.org/1999/xhtml%%1%%
xmlns:v=%%1%%urn:schemas-microsoft-com:vml%%1%%>");
buildHTML.AppendLine("<head>");
buildHTML.AppendLine("<meta http-equiv=%%1%%content-type%%1%%
content=%%1%%text/html; charset=utf-8%%1%%/>");
buildHTML.AppendLine("<title>Google Street View</title>");
buildHTML.AppendLine("<link
href=%%1%%/maps/documentation/javascript/examples/default.css%%1%%
rel=%%1%%stylesheet%%1%% type=%%1%%text/css%%1%% />");
buildHTML.AppendLine("<script
src=%%1%%https://maps.googleapis.com/maps/api/js?sensor=false%%1%%
type=%%1%%text/javascript%%1%%></script>");
buildHTML.AppendLine("<script type=%%1%%text/javascript%%1%%>");
buildHTML.AppendLine("function initialize() {");
buildHTML.AppendLine("var fenway = new google.maps.LatLng(" + lat + ","
+ lng + ");");
buildHTML.AppendLine("var mapOptions = {");
buildHTML.AppendLine("center: fenway,");
buildHTML.AppendLine("zoom: 14, ");
buildHTML.AppendLine("mapTypeId: google.maps.MapTypeId.ROADMAP");
buildHTML.AppendLine("};");
buildHTML.AppendLine("var map = new google.maps.Map(");
buildHTML.AppendLine("document.getElementById(%%1%%map_canvas%%1%%),
mapOptions);");
buildHTML.AppendLine("var panoramaOptions = { ");
buildHTML.AppendLine("position: fenway,");
buildHTML.AppendLine("pov: { ");
buildHTML.AppendLine("heading: 34,");
buildHTML.AppendLine("pitch: 10,");
buildHTML.AppendLine("zoom: 1");
buildHTML.AppendLine("}");
buildHTML.AppendLine("};");
buildHTML.AppendLine("var panorama = new
google.maps.StreetViewPanorama(document.getElementById(%%1%%pano%%1%%),panoramaOptions);");
buildHTML.AppendLine("map.setStreetView(panorama);");
buildHTML.AppendLine("}");
buildHTML.AppendLine("</script>");
buildHTML.AppendLine("</head>");
buildHTML.AppendLine("<body onload=%%1%%initialize()%%1%%>");
buildHTML.AppendLine("<div id=%%1%%map_canvas%%1%% style=%%1%%width:
320px; height: 200px%%1%%></div>");
buildHTML.AppendLine("<div id=%%1%%pano%%1%%
style=%%1%%position:absolute; left:0px; top: 201px; width: 320px; height:
200px;%%1%%></div>");
buildHTML.AppendLine("</body>");
buildHTML.AppendLine("</html>");
buildHTML = buildHTML.Replace("%%1%%", speechmark);
return buildHTML.ToString();
}
cheers guys.
ATB
Alex
On 27 Jun 2012, at 21:44, Nic Wise wrote:
> Hi Alex
>
> (nice location - I used to live about 10 mins from there on Westferry Rd)
>
> Anywhoooo....
>
> I think your options are:
>
> 1. Put a MKMapView in, load it up with the lat/lon (parse it out of
> the URL), and... well, it doesn't do street view, so you are kind of
> stuck there.
>
> 2. Try this:
> http://stackoverflow.com/questions/6329934/does-mkmapview-support-the-little-man-street-view
> - which basically uses a UIWebView to show it, but via the JS api. No
> idea if it'll work, but it is marked as "correct" on SO :)
>
> 3. Try to see what the google stuff is doing on the desktop - use
> fiddler or charles as a proxy in the middle? - and do that in your iOS
> code. Hacky, and a bit fragile, but it might work (or, put it on your
> server so you can change it without redeploying the app!)
>
> Last time I checked, streetview uses flash on the PC, so thats out on
> iOS. The Maps app (well, in iOS5 or less anyway! iOS[REDACTED] doesn't
> have streetview at all) does it manually - again, you might be able to
> sniff the traffic and get an image out of that?
>
> Maps doesn't work in the simulator, tho - so you'd need to be trying
> this on the device.
>
> So, you are just trying to display the result, right? With a quick
> play with Charles, I managed to get this out:
>
> https://cbks0.google.com/cbk?output=tile&zoom=4&x=0&y=3&cb_client=maps_sv&fover=2&onerr=3&renderer=spherical&v=4&panoid=3D9abaUQzvMsfpKqtyEd2g
>
> (its just down the road from there, I had to move to get something not
> in the cache)
>
> Now, I have no idea what the params are tho!! I think it's based on
> the panoid....
>
> Cheers
>
> Nic
>
>
>
> On Wed, Jun 27, 2012 at 3:06 PM, Alex White <[email protected]> wrote:
>> Hi all,
>>
>> a small bit of history, I have an existing application that currently runs
>> on MS windows it is database of points of interest, the application has a
>> lot of users, each of these users uses google with the street view option to
>> find these places of interest then using the link button on the page they
>> copy and paste the actual street view links into their databases, this in
>> most cases is the proper image of the point of interest not a map view.
>>
>> for example
>>
>> http://maps.google.co.uk/maps?q=East+Ferry+Road,+Poplar&hl=en&ll=51.491084,-0.030985&spn=0.000053,0.058622&sll=51.491843,-0.007523&sspn=0.007642,0.029311&vpsrc=0&t=m&z=15&layer=c&cbll=51.491166,-0.014654&panoid=RH906-yvUj2Wv3WzjuXNWw&cbp=12,183.75,,1,1.82
>>
>> these databases contain up to 20,000 links like the one above so moving over
>> to another system really is not an option considering that most of the work
>> is still carried out on the PC's and these links are moved onto the
>> iPhone/iPad for review later.
>>
>> I am not getting this to work properly in the UIWebview it is converting it
>> into some sort of mapping app, this is not what I want it to do, I just want
>> the UIWebview to display the URL I am passing and provide the results.
>>
>> I don't mind if I have to shell out to safari but that does not seem to work
>> either.
>>
>> UIWebView
>>
>> NSUrl nsurl = new NSUrl(_address);
>> NSUrlRequest req = new NSUrlRequest(nsurl);
>> HtmlViewer.LoadRequest(req);
>>
>> openURL
>>
>> UIApplication.SharedApplication.OpenUrl (new NSUrl (url));
>>
>> I have tried both on the simulator and physical device, I know that Apple
>> are moving away from google maps but this should still work as it is not
>> really using the API as it it is web driven.
>>
>> Any ideas.
>>
>> thanks
>>
>> Alex
>>
>>
>>
>> _______________________________________________
>> MonoTouch mailing list
>> [email protected]
>> http://lists.ximian.com/mailman/listinfo/monotouch
>>
>
>
>
> --
> Nic Wise
> t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
> b. http://www.fastchicken.co.nz/
>
> Earnest: Self-employed? Track your business expenses and income.
> http://earnestapp.com
> Nearest Bus: find when the next bus is coming to your stop.
> http://goo.gl/Vcz1p
> mobileAgent (for FreeAgent): get your accounts in your pocket.
> http://goo.gl/IuBU
> Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
> London Bike App: Find the nearest Boris Bike, and get riding!
> http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch