I am doing a bit of geocoding using Google Local Search and should be able to set the google maps api v3 object on the page on the watch page.
Now itβs ok if a local google search returned me a good viewport, like for a zip code or street, but if I typed the name of the bar, for example. The returned viewport is very large because the local search found many matches, but returned the best.
I would like to calculate my own viewport in this case and do it as follows:
result.Centre = new LatLon(double.Parse(lat),double.Parse(lon)); result.Span = new LatLon(0.006295d, 0.008407d); string viewport = "{{\"center\":{{\"lat\":\"{0}\",\"lng\":\"{1}\"}},\"span\":{{\"lat\":\"{2}\",\"lng\":\"{3}\"}},\"sw\":{{\"lat\":\"{4}\",\"lng\":\"{5}\"}},\"ne\":{{\"lat\":\"{6}\",\"lng\":\"{7}\"}}}}";
The problem is that I get some valid json, but Google Maps scales directly so that I can see the whole world. The same code is used in the interface, as if Google gave me a viewport, so I donβt understand what is happening.
Any ideas? I misunderstood my calculations? I tried the whole range (i.e. Assuming that this is already a radius) with the same effect.
Thanks in advance.
source share