The google maps API has a function for getting the bounds of a map, which 
adjusts at each level.

So, this is just a matter of calling on that function every time, so you get 
current bounds.

I will look at the stack later today.

Just be careful with bounds. They can cause confusion with changes in the 
orientation of the map.

Sent from my iPhone

> On Jun 30, 2017, at 10:10 AM, William Prothero via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> Jonathan:
> Here is a link to my test stack and some files I found that have various code 
> to find the corners of the downloaded map.
> https://www.dropbox.com/s/8xle2hrltx9ll0d/googleMapsAPiTests.zip?dl=0 
> <https://www.dropbox.com/s/8xle2hrltx9ll0d/googleMapsAPiTests.zip?dl=0>
> My start on a conversion is in the script of the “Get Corners” button. I can 
> get an xml file from the regular maps api, but the “bounds” property doesn’t 
> change with zoom, which makes it not obvious how to convert that to what is 
> being displayed, to get the corners. I have no problem converting pixels to 
> mercator lat/lon, but until I can figure out the relationship between pixels 
> and zoom levels, I’m stuck.
> 
> Thanks for any help. I know your augmented Earth application uses these maps 
> too, and I’m also willing to share code when I get this working.
> 
> Bill P
> 
>> On Jun 30, 2017, at 3:50 AM, Jonathan Lynch via use-livecode 
>> <use-livecode@lists.runrev.com> wrote:
>> 
>> Hi Bill,
>> 
>> Can you share the LC code and JS you are using? 
>> 
>> Sent from my iPhone
>> 
>>> On Jun 29, 2017, at 9:59 PM, William Prothero via use-livecode 
>>> <use-livecode@lists.runrev.com> wrote:
>>> 
>>> Folks:
>>> I’ve found a way to display an image of a google static map, in my app. 
>>> It’s quite easy and well-documented. However, I need to get the lat and lon 
>>> values of the corners of the map, at the displayed zoom level. There is a 
>>> simple-looking javascript example for doing this at:
>>> https://stackoverflow.com/questions/12507274/how-to-get-bounds-of-a-google-static-map
>>>  
>>> <https://stackoverflow.com/questions/12507274/how-to-get-bounds-of-a-google-static-map>
>>> My javascript knowledge is totally minimal and I am loath to learn 
>>> javascript just to get this one handler into livecode script.
>>> 
>>> What I have is an application that plots geophysical data on a world map. 
>>> The map kind of ugly at very high magnifications and I thought the google 
>>> map would give me a nice map image, with a wider range of magnifications, 
>>> and minimize local storage space. What I will do is display the map image 
>>> (centered on a particular lat/lon and magnification) in a rectangle, then 
>>> take a snapshot, then copy my data symbols and images into the resulting 
>>> snapshot. This works very will with my current map. I know that I can draw 
>>> symbols directly on a google map using the map api, but it will be much 
>>> more direct, and build on existing code, if I do it as described.
>>> 
>>> So if anyone who is familiar with javascript has a few moments to give me 
>>> some pointers on how I might convert this to LCS, I’d very much appreciate 
>>> it. What I’m scratching my head over is how to access the parameters from 
>>> the Google API to do the needed calculations. The link above is to the 
>>> javascript example.
>>> 
>>> Thanks in advance,
>>> Bill P
>>> 
>>> William A. Prothero
>>> http://earthlearningsolution.org/
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your 
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to