CityZenApp / AndroidApp

CityZen Android App, OpenStreetMap base-map
http://cityzenapp.co/
Mozilla Public License 2.0
75 stars 29 forks source link

Tiles usage policy #85

Open jbelien opened 6 years ago

jbelien commented 6 years ago

According to OpenStreetMap Tile Usage Policy :

Heavy use (e.g. distributing an app that uses tiles from openstreetmap.org) is forbidden without prior permission from the System Administrators.

So we'll have to use an alternative at some point ! This is just a notice so we don't forget this issue ; not being a Java developer I unfortunately can't really propose a solution to this.

jbelien commented 6 years ago

I guess Mapbox GL could be a solution : https://www.mapbox.com/android-docs/map-sdk/overview/

AndyScherzinger commented 6 years ago

We can also check for caching, since the osm android lib offers offline maps (and I think also caching)

jbelien commented 6 years ago

Unfortunately caching is not enough to use tiles.openstreetmap.org ; those are rather small servers so it can be used only for testing.

AndyScherzinger commented 6 years ago

Alright, I just thought that the page stated caching for at least 7 days, so if we would have done that we would be save.

AndyScherzinger commented 6 years ago

@jbelien do you know of any OSM services which can be used for production, non-testing setups like CityZen?

jbelien commented 6 years ago

@jbelien do you know of any OSM services which can be used for production, non-testing setups like CityZen?

I still suggest to use Mapbox GL ! Very nice and robust product, even though you'll have to pay for it at some point.

Otherwise there are some other companies/groups that provides tiles :

It will just depends on the usage policy and the price you're ready to put in it. You could even host the tiles yourself ; I did it for Belgium (https://tile.openstreetmap.be/) and it's ""relatively"" easy to setup but it needs some maintenance and infrastructure of course.

AndyScherzinger commented 6 years ago

@rskikuli what do you think?

rskikuli commented 6 years ago

@AndyScherzinger & @jbelien many thanks on your feedback on this. After also talking with the creator of a similar app (Transportr) I think that the best way to go at the moment is Mapbox. In the mean time the discussion about covering the costs will be intensified because we need to make sure that after reaching the freemium limit there will be no issues with the service. some things that need your opinion

jbelien commented 6 years ago

Check here to see what's possible : https://www.mapbox.com/mobile/

can we choose between different map designs?

Yes, you can see the style available here : https://www.mapbox.com/maps/
and see https://www.mapbox.com/help/first-steps-android-sdk/#change-the-map-style

can we implement the 'walking route' feature with Mapbox?

Yes, definitely (and much more) !

do you think this would be better implemented in this update or the next one?

Sooner the better I would say but I have absolutely no idea about the amount of work (and unfortunately can't really help 😞 ).


Some examples : https://www.mapbox.com/android-docs/map-sdk/examples/ Demo of what's possible to to with Android SDK : https://play.google.com/store/apps/details?id=com.mapbox.mapboxandroiddemo&hl=en

rskikuli commented 6 years ago

It seems that this will need more work for research, discussion and also development. Labeling this for ver 1.2.0.

AndyScherzinger commented 6 years ago

I agree with you @jbelien and @rskikuli. For 1.1.0 it is already to late since I won't be able to spend much time on the app in the next 4-5 weeks (maybe even none at all :cry:). So for 1.1 we did a lot of fixes and general improvements while when using mapbox is it a more or less complete rewrite of (at least) anything map related.

rskikuli commented 6 years ago

Guys mapbox seems to be the best scenario at this stage. Let's go for it. @jbelien do you think Mapbox offers also possibilities of an offline version? @AndyScherzinger is this something you can help at some point? Based on the feedback I got from State of the Map conference it should be a high priority feature for us and all our energy should be focused there. This is an issue related to #38. Offline usage also offers more privacy to users since they are not connected online when they navigate.

AndyScherzinger commented 6 years ago

@AndyScherzinger is this something you can help at some point?

At some point sure while I can't say when this will be and how long it'll take, being pretty busy at the moment :/

jbelien commented 6 years ago

@jbelien do you think Mapbox offers also possibilities of an offline version?

Yes, the "Mapbox SDK for Android" provides Offline use : https://www.mapbox.com/android-docs/maps/overview/offline/

PrasannaVenkadesh commented 6 years ago

Good conversation. Obviously depending on openstreetmap.org tile server is very bad practice since our app as used by many people will only increase load on those servers. Mapbox, NextZen, OpenMapTiles everyone of them serve vector and raster tiles online. But at the same time they are also limited by number of API requests or tile requests being served.

In my opinion if the app has to be self-sufficient (or) sustainable in the long run without having to depend on external services (remember the shutdown of MapZen had hurt many applications) and without having to spend much for paying for the services, then Offline maps and routing has to be integrated as a primary design feature.

OsmAnd+ is a very good example. With this thought, I propose two libraries that can be used to achieve the same with CityZen as well.

  1. mapsforge/vtm can be used as a map provider (offline) with VTM renders the offline maps on-demand on-device (eliminating the need for pre-rendered tiles).
  2. graphhopper offers excellent routing for various vehicle profiles and also can work completely offline on device.

As I already shared in our Telegram group, I have written a shell script that can prepare raw osm data into mapsforge format as well routing data required by graphhopper.

Unlike OsmAnd's pbf vector binary format, mapsforge's map format is highly compact and consumes very very less disk storage space. For example, the raw data of Tirane, Albania from OSM is around ~70mb. The same when processed and converted into mapsforge binary format is just 1.7mb.

The only online requirement would be to provide public downloads of the mapsforge maps for various countries of the world like this (http://download.mapsforge.org/maps/) and we should have a download section in our app for multiple regions. The world overview mapsforge map is already available in the same link. This file is just 3.8mb which can be distributed along within the apk and when starting the application for the first time can copy this world map into internal or external storage of the device.

The rest of the world regions should be made available for download and once downloaded the app should be able to work without Internet and next time they connect to Internet the app can periodically check for new map file updates and it is upto the user to update.

We can also customize the theme for the maps with VTM coming up with unique colours as well. The combo offers a lot of flexibility for exactly this purpose.

I have already forked and started working on integrating mapsforge/vtm with the application. I will share screenshots, sample demo apks before issuing pull requests.

PrasannaVenkadesh commented 6 years ago

I would like to know your feedback. I shall wait and proceed after that.

cityzen-vtm

jbelien commented 6 years ago

@PrasannaVenkadesh That's absolutely awesome ! 😍

I suggested Mapbox Android SDK because I know nothing about Android map abilities (and didn't know about VTM). But seeing the result here above, I'm definitely convinced !

If we can provide VTM extracts per country, I think we have a solution that fixes both offline use and OSM.org tile usage policy 👍

PrasannaVenkadesh commented 5 years ago

After the above Screencast, I haven't progressed much on it.

In our existing app, I see there are multiple places where MapView is recreated as fragment based on the location passed. The current issue with Mapsforge VTM is that, even though multiple instance of mapview is supported, it is buggy when it comes to having multiple MapViews on multiple fragments or dialogs.

We have two options here.

  1. Go ahead with Mapsforge's VTM library, but stick with only one MapView Fragment. This requires some changes with current activities and fragments flow.
  2. Wait until this bug is fixed in VTM.