Can we download OSM map tiles and use it for commercial product - leaflet

I am working on commercial product, where I have to use map tiles in the offline.
I have downloaded tiles from OSM
https://a.tile.openstreetmap.org/{z}/{x}/{y}.png.
Can we use these tiles for commercial product by downloading the tiles and placing in my server(I might have to edit the tile images in terms of colors).
Update
In the same way Can we download the tiles from the domain ?
https://openstreetmap.in/#5/22.150/79.081
If this is also same policy why private key/token is is mentioned here?
https://github.com/osm-in/openstreetmap.in#using-this-map

Yes, but...
Using OSM tiles for commercial purposes is allowed as already mentioned in Gilles-Antoine Nys's answer as long as you add proper attribution. See the Licence and Legal FAQ as well as the OSM tile usage policy for details.
However you are not allowed to bulk download OSM tiles! OSM tile servers have limited resources and this will result in getting banned. If you need lots of tiles then either render your own tiles or get into contact with a third-party tile provider.

OSM maps are distributed under License : Open Data Commons Open Database License.
You are free to copy, distribute, transmit and adapt our data, as long
as you credit OpenStreetMap and its contributors. If you alter or
build upon our data, you may distribute the result only under the same
licence. The full legal code explains your rights and
responsibilities.
The cartography in our map tiles, and our documentation, are licensed
under the Creative Commons Attribution-ShareAlike 2.0 license (CC
BY-SA).
So the answer is Yes, but with restrictions.
Accordingly to Copyright and License - OSM Webpage

Related

Finding USA's roads key attributes for OpenStreetMap

I understand that most of the data in OSM for USA is coming from TIGER. It seems that this doesn't have complete road key attributes such as speed limit, maximum weight, allowed / restricted turns, lane change etc.
I found that some state level DOT do have public datasets available for the roads within their jurisdiction, however some states don't have that. I wonder if the OSM community knows if the data already available at these state DOT's was loaded in the OSM?
Please also let me know if there was a netter place to ask this question?
Many thanks,
It is stated in the OSM webpage as well as in other GIS blogs that OSM doesn't have much data on key attributes of roads ie truck restrictions, however some DOT do have data on that.
In OSM pages it wasn't clear if that data was loaded.
There's been an awful lot of discussion about data imports, especially within the USA, over the years. I suspect that if data is available and hasn't been imported into OSM it's for one of two reasons:
the quality isn't very good
the licence isn't compatible
The relevant OSM wiki page that explains what would someone suggesting a new import need to do is here. With regard to the "community buy-in" step, I'd suggest contacting the OSM USA community in the first instance via the forum, mailing list or OSM US' slack workspace.

State/Province World Data

Currently I am trying to develop a multi-layered Leaflet map using GeoJSON (for country, states/provinces) and CSV (for city data). I want it to go down all the way to city level and that requires layers of Country, State/Province, and City data. I have all the Country data I need in the format I require (GeoJSON) and I have a decent source for City data in a CSV format.
However, I only have USA, Canada, Brazil, and Australian states/provinces and I have been looking around but haven't been able to find a reliable source such as NaturalEarth (which is where I initially got my states/province data from).
Does anyone have a resource they could point me towards? Even if it is multiple, hopefully I can merge them together in mapshaper/other open source applications. I've been looking for the past month but I am new to geographic visualization so I don't know the good spots to look yet.
Thank you so much for any help
You can try BBBike exports of OpenStreetMap data. Probably you will have to export bit by bit as there is a size limit to what you can export.
I recommend you also OpenStreet map. Osm also uses NaturalEarth for higher layers.
But I would download their database (for test, just download a small country, then you can download continents at a time).
Then I would select the features I'm interested. In your case the boundaries (region, districts, cities/municipalities), and city/hamlets names. Then you should look at the tools they have (and what you need). My simple and stupid way would be just to import such features in a GIS database, and then use it to get data. But you may find shortcuts and use directly the data without importing in a database.
Check OSM wiki, Downloading data and Planet.osm page, and other linked pages about tools. You may need to look the Feature page to known what features you want (just to discard most of the data).
If you want to use the tiles (pre-rendered images), you may need to read the term of services. It may be easier to download all data and render in your server, or to buy a service which offer you tiles. (all in the wiki).

Is it allowed to download and use Microsoft Aerial imagery in research papers?

I was wondering if it is allowed to download and use (i.e. I mean processing not just displaying) Microsoft Aerial imagery in research papers? Is there any reference clearly mentioning the use of these data for research purposes?
I believe this would fall under the print rights: https://www.microsoft.com/en-us/maps/product/print-rights
Generally, using screenshots in research papers of an application with Bing Maps is not usually an issue. Just be sure the copyright information is clearly displayed.

To load layer on leaflet even on offline

I'm using leaflet map in my ionic application.
On offline, by default, open street map layer loads but when changing the zoom level, the map disappears.
How can I get the map to show when zoomed offline?
You need to download (pre-cache) the tile images to work with offline mode.
Download the tiles at the zoom levels you want. Map data is quite large and so you may want to limit to a small subset of zoom levels, or a geographic boundary (a city, country, etc.)
OSM's specific tile usage policy is here: http://wiki.openstreetmap.org/wiki/Tile_usage_policy But the part that applies to your app is this:
In particular, downloading significant areas of tiles at zoom levels
17 and higher for offline or later usage is forbidden without prior
consultation with a System Administrator.
That page also lists numerous "free" tile providers. Because I expect it to change "significantly" over time, I'm not gonna copy and paste it for you.
Unless you enter into some kind of contract/agreement with the tile provider, you may need to render your own or find a different tile service that will allow you to pre-cache tiles.
The details for downloading map data that can be rendered as tiles can be found on the OSM website: http://wiki.openstreetmap.org/wiki/Downloading_data
There are multiple ways to get the data from OSM, but these services and options will undoubtedly change over time so I think it safest to just refer to their website (google "download open street map data" if above link is broken).
I have used a .NET library called BruTile to manage the tile cache. But basically it is just a bunch of image files organized in a zoom/grid structure.
It would also be good for you to google search topics such as "ionic leaflet tile cache" and "pre cache map tiles ionic" and such. There isn't a lot out there yet, but this is a growing area of development.
Thoughts regarding mobile apps
If you are deploying to mobile devices it probably doesn't make sense to deploy the pre-cached tiles because (a) they will become out of date and require constant upkeep, and (b) large file size resulting in slow downloads. It would be better to download tiles while online after the app is installed.
Windows and Android phones both allow download of offline map data in their maps apps. It may be possible to leverage that data. Otherwise you would make your app work similarly: prompt user to download maps for their region, and then find a way to reasonably specify the region (geographic area) for which they need maps. It is also a good idea to let the user know how much data will be downloaded for metered data plans and device storage.
It also would be better for you to use a server other than the OSM servers, such as a paid Microsoft or MapQuest or Bing account. The OSM servers aren't capable of handling production load across every SPA that wants maps to work offline. Better to rely on the device's capabilities and built-in maps app if possible. Amazon and Azure (for example) services may be feasible for this. If you wrote your own program to run as a service on your own sever it could pre-cache tiles from the tile service (thus reducing your usage fees and server load) and then the apps would just get map data from your server. This also gives you the opportunity to get creative with your own custom tiles.

Is there an offline Map layer available for Leaflet?

Is there an offline Map layer available for Leaflet? I don't need in detail, but basic geometry would be sufficient.
For sure you can set up your own offline map (raster tiles and/or vector shapes). The difficulty or out-of-the-box availability depends on what kind of information and level of details you want.
GeoJSON:
The easiest is if you need just world countries borders with little detail, just to get the outline. In that case, you can find GeoJSON files on Internet that contain that data for a few hundreds kB (the weight of a single normal big image), e.g. https://github.com/johan/world.geo.json
Then simply use L.geoJson(geoJsonData).addTo(map) to have it shown.
Demo: http://plnkr.co/edit/aB6p7IC2cF7xW41Ju8m7?p=preview
Downloaded tiles:
A more complex (technically and contractually) but still manageable situation is if you want raster tiles (like the OSM website for example). You can download tiles (which are just normal images) from an online server, then use them offline. This is called "tiles scraping" or "tiles bulk downloading".
As for the technical side (you may have to download thousands of individual images, depending on to which zoom level / details you want to use offline), several software are available (have a look at the above OSM Wiki link).
As for the contractual side, many tile servers (including OSM for instance) specifically require in their Terms of Use not to perform bulk downloading (as it generates high demand and uses high bandwidth on their servers). So you should look for a service that accepts this usage.
Render tiles locally:
A perfectly authorized solution (but the most technically complex) is to download the raw OSM data, and to use it through software to generate your map (whether raster tiles or vector shapes).
You can probably find services on Internet that offer to download simplified OSM data (the full database for the entire planet is ~30 GB compressed…) or for a small geographic area (see the above OSM Wiki link).
Regarding the software, the link provided by chrki in the question comment (http://wiki.openstreetmap.org/wiki/Rendering) should get you started.
In particular, you can very well generate raster tiles once, save them and get rid of the rendering software, so you can use those tiles as if you had scraped them.
You can build your own local osm server. It is quite easy using Ubuntu, because there is special packages for it. Installation process is described on this great resource: switch2osm.org
Here is an example using NeDB and modifications to this project/examples https://github.com/tbicr/OfflineMap: https://github.com/KD0NKS/APRSViewJS/blob/master/js/techpire/LayerManager.js. This only caches what the user has already viewed and avoids bulk downloading from osm servers.
There is also a Leaflet Plugin: https://github.com/MazeMap/Leaflet.TileLayer.PouchDBCached