Downloading OpenStreetMap maps as png-images without a browser - openstreetmap

Currently I am using Selenium and Folium to download OpenStreetMap maps... The issue I am encountering now is that, for my next assignment, I have to download 5 million images, and my current Python script is too slow. Having that one running in the background for hours on my laptop is not really an option.
Currently, my script opens the browser, saves the screen and extracts the nxn pixels image I need.
Does anybody know of a smarter way of extracting maps from OpenStreetMap?
Currently, I have a CSV list of 5'ish million x & y coordinates of points, and I need to download a map for each one of these in png-format... How should I proceed?

I hope you are not downloading from openstreetmap.org tile servers, because this is strictly discouraged as you can see on https://operations.osmfoundation.org/policies/tiles/ under "Bulk Downloading".
It might make sense for you to setup an own tileserver or subscribe to some tile-server service. There are static map services, which allow you to download the combined map image of an area, see
https://justmarkup.com/articles/2014-05-27-overview-of-static-map-solutions/#openstreetmap
for example.
This mentions Mapquest and Mapbox.

Related

Use existing offline raster mbtiles to display on mapbox map

I'd like to transition the map in my app from currently Apple-Maps-SDK to Mapbox. My users already downloaded a lot of offline maps into several .mbtiles tiles containing raster data.
My question now is if it's possible to still use those while the user will be transitioning to the new maps? I just don't simply want to delete all offline maps and tell the user that he needs to download everything again right now, but rather give them a time-window to do that...
I was looking at MGLRasterTileSource/MGLSource and thought that I can create a subclass and somehow provide my own data to the map, but this does not seem to be supported. There are no datasource methods on it for that purpose...
Would be great if somebody could point me into the direction on how to archive what I want.
EDIT:
So I thought it might work that way... I migrate my existing raster tiles into a downloaded pack inside the mapbox offline database. So I had a look at the caches.db but at least the data in there is not just a plain png/jpg (tried with the mapbox satellite images, which should be raster).
Cause there is no public interface for getting existing raster-tiles in there, is there?
I've seen an other solution where somebody is hosting a webserver inside the app... but that somehow looks like quite an overkill to me?!?
https://gist.github.com/namannik/3b7c8b69c2d0768d0c2b48d2ed5ff71c

QGIS - Composer

My question concerns the general purpose of the composer in qgis. My first idea was that with the composer you can "save" different layer combinations with different style to gain the possibility the have different "views" on the same data. However I realized when I change the map in QGIS, the information in the composer is also refreshed. To clarify my intent I want to give a small example:
Assume you have the gas stations of different companies for a country and you want to produce a map with all companies and maps containing only the gas stations of a certain company. So in the beginning I though I just create different composers to gain different maps but I somehow fail.
If I understand your question, you can use the composer as you wish.
When you have finished a composer, click on the map and, in the object properties, just check "lock layers for this map."
It should no longer be updated, even if you hide or display layers.
Regards.
Vincent
For large projects with a large number of composers, it's better to use layer presets and the "Follow visibility preset" option within the composer.
This is because when using "lock layers" and "lock layer styles", it saves all of the layers and their styles and properties. When it does this for each composer, it can quickly balloon the size of the QGIS file. This can make it take an extremely long time to open a project, cause a lot of performance issues, and inevitably will corrupt your QGIS file. Following a visibility preset simply references the style for the layer rather than duplicates it.
E.g. I had an employee whose QGIS file got corrupted and I had him send it and the backup files to me. On review, the primary QGIS file was empty, and the backup file was an exceptional 65mb. The markup behind the QGIS file was nearly a million lines long. It was corrupted because it got cut off, so I'm not even sure how long it might have been in it's entirety. This was a result of him having about 30 layers and over 100 composers that each had the layers locked. It also explained why he was the only one who was constantly complaining about his laptop being too slow for the work :)
in answer to your statement “My question concerns the general purpose of the composer in qgis”
For me and as In understand the purpose of the print composer in qgis is more to provide an output for GIS project in a cartographic format .and it is very Cleary detailed in the qgis documentation “The Print Composer provides growing layout and printing capabilities. It allows you to add elements such as the QGIS map canvas, text labels, images, legends, scale bars, basic shapes, arrows, attribute tables and HTML frames “(see the link bellow)
If you need more information about how to use it please visit this link
https://docs.qgis.org/2.2/en/docs/user_manual/print_composer/print_composer.html?highlight=qgis%20composer
Best Regard,

How to compact mbtiles with mbutil

I'm creating maptiles with arc2earth and ArcGIS and it creates a lot of duplicate tiles.
I would like to reduce its size using mbtiles. I think it is possible to "compact" tiles, but I don't find the way.
Do you know if mbtiles still have compact command or it is just been deprecated?
Thanks!
At the moment mbutil doesn't expose this as an option - TileMill is the only client that supports properly compressed tiles. Of course, mbutil is an open source project, so if you're game, you can built it and add it.

How to use download openstreetmap file to serve a local map app?

I have download a partial area data file (OSM format) to local. I have a local server which not connect to internet. So I want to build a local map app only with local OSM file (I use OpenLayer js).
I searched openstreetmap.org wiki, but find no solution.
Is there any way or documentaton to solve this?
By "local" you mean local on your machine or a local web server?
First you need to generate map tiles. Then you prepare the map HTML, including the OpenLayers code. The tile URL should point to your tiles (in case of a local machine, just use the "file://" protocol for URLs).
Here's one way how you can generate tiles (you can skip some of the steps): http://braincrunch.tumblr.com/post/9921938947/maperitive-tutorial-a-hiking-web-map-in-ten-easy-steps
1) i have to create an API that connects to a locally downloaded openstreet map and does to following:
2) Given a GPS location display the location on the map.
3) Be able to display the route to the location and update while the individual is on the move.
Numbers 2) and 3) are not yet my problem. number 1) is my problem for now. i don't even know where to start. i have been searching but still saw nothing i can understand.
what i want to know is: where to download OSM that i would be able to use locally? an example or a tutorial on an API that connects to the map locally and able to display it(and maybe able to zoom in, zoom out)?
the API can be in java, c#, or c++. but any other language is welcome as i have no choice.

Making a map for iPhone based on pre-prepared google map

my client prepared google map with points on. Now he wants that points on map in iPhone app. Is there way to export points from map prepared by him ?
If your client prepared the map in Google Maps, then he can use the "KML" link in his Google Map to download a file with all his data points in it, in KML format.
Did he use javascript to prepare the points and can you get that? If so, use the source.
Did he use maps.google.com to prepare it by dropping points on that? If so, click the URL button and you'll should see the points embedded in the URL, at least that is true for driving directions.