3

We have a Qt program written in C++ to request wms tiles and display them. This works fine.

Now we want to display imaginery from Google Maps and due to some restrictions in our program, we can't use javascript and we have to directly manage the url. For example, in the wms case:

www.idee.es/wms/PNOA-MR/PNOA-MR?SERVICE=WMS&VERSION=1.3.0&FORMAT=image/jpeg&CRS=epsg:32629&LAYERS=PNOA-MR&STYLES=&REQUEST=GetMap&EXCEPTIONS=INIMAGE&TRANSPARENT=TRUE&WIDTH=256&HEIGHT=256&BBOX=621921.34,4794536.07,622951.58,4801396.70

So I think the right choice for Google Maps would be the static API.

Now, reading it I didn't find anything regarding querying by bounding box. Only querying via a center and a zoom level.

Is that the only way to retrieve an image? Wouldn't it possible to query with a bounding box without specifying a center and the zoom level and retrieve an image representing that extension? Just like with the wms case before.

NOTE: I would like and url example if possible. We can't use javascript for this.

5

Google Static map api requires centre,lat/lng and pixel size as well as zoom level

This is a non-JavaScript version (but python) for working out the pixel dimensions.

You will need to modify to suit your needs but the key point is that it contains

CalculateBoundsZoomLevel 

Which take a cluster of points and calculate the zoom level and centre of the map required.

This method is used to take in a bounding box (southwest and northeast
bounds of the map view we want) and a map size and it will return us a zoom
level for our map.  We use this because if we take the bottom left and
upper right on the map we want to show, and calculate what pixels they
would be on the map for a given zoom level, then we can see how many pixels
it will take to display the map at this zoom level.  If our map size is
within this many pixels, then we have the right zoom level.

http://code.google.com/p/google-ajax-examples/source/browse/trunk/nonjslocalsearch/localSearch.py

  • Very nice! I can't upvote you, though! :( – Kio Marv Jan 8 '14 at 14:51
  • You need a rep of 15 to upvote - so you need two more users to upvote your good question first. – Mapperz Jan 8 '14 at 15:03
  • The link to code.google.com no longer works. It appears that this is a clone (?) of the original code, though: github.com/gbrammer/threedhst/blob/master/threedhst/gmap.py – Clay Mar 7 '16 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.