# How does zoom level affect bounds?

 0 Hello! I am trying to find a method to find bbox bounds (left, right, top, bottom) from given zoom level and coordinates. I am writing a function in MATLAB that uses zoom and coordinates as parameters to go to openstreetmap.org and export the OSM just as openstreetmap does so that I can easily save several different OSM files and open them as xml files from within MATLAB, moving towards the next goal of recreating maps from the OSM files. asked 18 Dec '18, 22:50 jholland4134 26●2●2●4 accept rate: 0% 1 I do not understand your question, sorry. Why should a zoom level affect coordinates at all? Please give some more detail. By chance: do you mean the edge coordinates of a view area? (19 Dec '18, 06:56) aseerel4c26 ♦ My apologies, I meant how does the zoom level effect the bound box's coordinates/min and max latitude and longitude. For example, if I select latitude of 28.06597 and longitude of -82.52889 with a zoom level of 19, top=28.06582, bottom=28.06612, left=-82.52937, and right=-82.52841. I'm trying to figure out how to calculate these bounds. Link I'm referring to: https://www.openstreetmap.org/export#map=19/28.06597/-82.52889 (20 Dec '18, 03:06) jholland4134 1 So basically you wan to know how the website calculates these four values based on your centre coordinates from the URL ("28.06597/-82.52889") and the currently displayed map size? While someone could surely answer that (probably with a deep reference to the OSM website code), I fail to see why this is useful - except if you want to program such a website. So, is this what you want? (20 Dec '18, 06:09) aseerel4c26 ♦ 1 The bounds of the map on the website don't just depend on the zoom level and center coordinate.T he size of the map div inside the browser window also matters, i.e. the screen resolution and a few things more. But maybe you are actually searching for something different. Did you already read slippy map tilenames? It contains a collection of formulas and explanations. (20 Dec '18, 09:19) scai ♦ 1 aseerel4c26, that is correct but what I am trying to do is to write a function for MATLAB to retrieve the OSM from openstreetmap.org by providing zoom and coordinates as parameters. Right now, the code works but how I was handling zoom's effect on the bbox is not the same as open street map, leading to a smaller bbox and OSM files that differ from open street's exported OSM files. scai, I have not yet but will take a look. Thank you for the link. (20 Dec '18, 17:52) jholland4134 After looking over the link to the slippy tilenames, I noticed the Perl LonLat_to_bbox program seems to be what I'm looking for. The only issue to sort out is that the code is meant for embedding a map and uses the desired width and height as part finding the corresponding OSM. (20 Dec '18, 18:30) jholland4134 @jholland4134: Yes, Perl LonLat_to_bbox seems to be what you want, but I do not understand your problem to use this code. As also said in my first comment: you need to provide more detail. E.g. which framework do you use in Matlab? What are you displaying there? It would be nice if you could add this to your original question text ("edit") - that makes this question entry easier to read for others coming by with the same question later on. (20 Dec '18, 18:53) aseerel4c26 ♦ @jholland4134: By the way, the https://www.openstreetmap.org/export function of osm.org is meant for small scale exports only. No big ones, no heavy use, and is - as the website in general - targeted at mappers. There are other options - see https://wiki.openstreetmap.org/wiki/Downloading_data . As long as you are just in development phase that use of /export is perfectly fine! (20 Dec '18, 18:53) aseerel4c26 ♦ @aseerel4c26 Thank you for the suggestion, I updated the question with some more detail. I simply want to use MATLAB to export the OSM file and then open it within MATLAB as an XML. The purpose is to use coordinates for several locations from another file as function parameters to go to openstreetmap and export the corresponding OSM files. (20 Dec '18, 19:07) jholland4134 showing 5 of 9 show 4 more comments
Be the first one to answer this question!
 toggle preview community wiki:

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Question tags:

×88
×25
×3

question asked: 18 Dec '18, 22:50

question was seen: 1,111 times

last updated: 20 Dec '18, 19:10