Jump to content

 
Photo

zoom levels

- - - - -

  • Please log in to reply
4 replies to this topic

#1
josie

josie

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 120 posts
  • Gender:Female
  • Location:Netherlands
  • Netherlands

Hi there,

I am using a google maps api but have some problems with zoom levels for countries and regions. The zoom levels always seem to come up not quite right (usually too far out) when searching for countries. Can anyone point me to some information or give some tips for calculating best zoom levels.

Or is it a case of setting things manually? Surely not in this day and age :)

Thanks...

#2
Hans van der Maarel

Hans van der Maarel

    CartoTalk Editor-in-Chief

  • Admin
  • PipPipPipPipPipPipPip
  • 3,859 posts
  • Gender:Male
  • Location:The Netherlands
  • Interests:Cartography, GIS, history, popular science, music.
  • Netherlands

I am using a google maps api but have some problems with zoom levels for countries and regions. The zoom levels always seem to come up not quite right (usually too far out) when searching for countries. Can anyone point me to some information or give some tips for calculating best zoom levels.

Or is it a case of setting things manually? Surely not in this day and age :)


I think it can be calculated based on the bounding box of a country (in projected coordinates), but I don't have a formula ready for you off the top of my head. Certainly not easy and you may still have to manually take care of the countries crossing the 180/-180 line (Russia, USA, Fiji)
Hans van der Maarel - Cartotalk Editor
Red Geographics
Email: hans@redgeographics.com / Twitter: @redgeographics

#3
josie

josie

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 120 posts
  • Gender:Female
  • Location:Netherlands
  • Netherlands

Hi Hans,

Thanks for the reply. I have seen the bounding box method.

As an example, if I search UK on google maps I get a view that is a little too far out for my liking, this also happens when using the api and is the case for most countries. I would like it if the map would only incorporate what I define (or what someone would generally accept) as the extents of a country, perhaps using a bounding box method, specifying four corners or something.

I guess I do not mind manually setting the level for each country, however I wanted to see if there is another way first.

Thanks again,

Johanna

#4
josie

josie

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 120 posts
  • Gender:Female
  • Location:Netherlands
  • Netherlands

Ok, I am testing an idea, that is to zoom in just a little more (one zoom level) than google does on their api for countries. This seems to actually work for me. Will let you know if it is a successful workaround for now :)

#5
Crischan

Crischan

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 199 posts
  • Gender:Male
  • Location:Eberswalde, Germany
  • Interests:Spatial Information Design
  • Germany

Tile based maps like Google have a limited set of fixed zoom levels and thus can not just zoom to fit a given bounding box just right.
If lets say your country would use all of zoom level 10 but for a tiny two pixels which fall outside, zoom level 9 will be used instead and you might end up only using 80% of the map size for your country.

An (estimated) overview of zoom levels and their corresponding scales can be found here. Using this and the size of the map display you can then calculate what zoom level you will end up. Word of warning: There's a trap though - probably Google will use a estimate of your screen resolution which likely will not be very precise. Thus math becomes more complicated...
Crischan Wygoda
http://wygoda.net




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->