0

The MapQuest open data site states:

Please also note that global coverage is provided at zoom levels 0-11. Zoom Levels 12+ are provided only in the United States (lower 48)

I want to be able to use the MapQuest 12+ zoom levels in the USA lower 48 and provide my own tiles for outside the USA lower 48.

I am using OpenLayers and with GeoServer for my own tilesets for outside the USA

What is the best way to determine if my viewport or map center is contained in or out of the lower 48 so I can switch layers?

1 Answer 1

2

You should be able to adopt the following Python code to the language of your choice. Grab the coordinates of your map center and determine if it falls within the bounding box of the contiguous 48 states.

#More accurate values can be found @
#en.wikipedia.org/wiki/Extreme_points_of_the_United_States

top = 49 #northern-most latitude
left = -124 #western-most longitude
right = -67 #eastern-most longitude
bottom = 24 #southern-most latitude

def within(lat, lon):    
  return True if bottom <= lat <= top and left <= lon <= right else False

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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