iosandroiddev / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

Adding MapBox As Tile Provider #491

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I see that OSMDroid currently has explicit support for maps from CloudMade, 
Mapquest, OpenCycleMap, and Microsoft but not MapBox.  I'm interested in adding 
this support and have built a proof of concept app called BikeMapBox that does 
so.  Please let me know what the team thinks about this possibility.

https://github.com/bleege/BikeMapBox

Thanks!

Brad

Original issue reported on code.google.com by bleege on 8 Nov 2013 at 4:03

GoogleCodeExporter commented 8 years ago
Looks interesting

Original comment by neilboyd on 9 Nov 2013 at 8:24

GoogleCodeExporter commented 8 years ago
What would be needed to add this to osmdroid? As far as I can see it's just a 
standard TileSource where the URL includes the API key, so I can't see how to 
include that generically in osmdroid. But anyone who wants to use it with 
osmdroid can do so very easily, as you've done in your sample app.

Original comment by neilboyd on 10 Nov 2013 at 2:37

GoogleCodeExporter commented 8 years ago
Agreed... the Tile Loading portion is pretty straightforward... now that it's 
done.  I'd been looking on the Web and talking with MapBox engineers about how 
to get their Map Tiles natively on Android for a while now but there was no 
good information on how to do this to be found from either source.  While 
building my sample app I saw that OSMDroid already had other providers (e.g., 
CloudmadeTileSource) in the codebase to provide straightforward integration and 
thought that other people, especially those new to the OSM world, might benefit 
by not having to re-invent the wheel.  The MapBoxTileSource definitely could be 
further simplified.  For example it could be setup to just require the MapBox 
Map Id in a constructor.  I've also started adding support for MapBox Markers 
(Maki) which people might find useful too.

https://github.com/bleege/BikeMapBox/tree/master/src/com/bradleege/markers

Original comment by bleege on 10 Nov 2013 at 5:11

GoogleCodeExporter commented 8 years ago
I could add MapBoxTileSource to osmdroid, but I couldn't add it to the list of 
standard providers because it requires a key and as far as I can see there's no 
free plan.

Original comment by neilboyd on 10 Nov 2013 at 8:07

GoogleCodeExporter commented 8 years ago
That's great!  I'm really excited about being able to contribute.

I updated the MapBoxTileSource this morning to add support for a basic, 
intermediate, and fully customizable constructors along with JavaDoc comments.  
It should be good enough starting place for most developers.

https://github.com/bleege/BikeMapBox/blob/master/src/com/bradleege/tilesource/Ma
pBoxTileSource.java

I also did some research this morning and found out that MapBox does still 
offer Free plans (which is what I'm using).  It just requires signing up for an 
account to make your maps and get the map key.

https://www.mapbox.com/plans/

Please let me know if there's anything else I can help with!

Brad Leege

Original comment by bleege on 11 Nov 2013 at 3:47

GoogleCodeExporter commented 8 years ago
Looks good. If there's a free plan I can add it to the sample app.

Original comment by neilboyd on 11 Nov 2013 at 9:14

GoogleCodeExporter commented 8 years ago
There are a lot of similarities with Bing Maps and so it should be implemented 
the same way.  Specifically, retrieving the key from the manifest, and being 
styleable.

Original comment by neilboyd on 11 Nov 2013 at 9:42

GoogleCodeExporter commented 8 years ago
I've updated the code to retrieve the mapId (aka key) from the manifest file as 
suggested.  I didn't implement the IStyledTileSource<T> interface as MapBox 
appears to only allow styles (Streets, Terrain, Satellite) to be changed via 
their Map Editor Web app and not via the API.

Core API
https://www.mapbox.com/developers/api/

How To: Enable Terrain Imagery
https://www.mapbox.com/help/#enabling-terrain-visualization

How To: Enable Satellite Imagery
https://www.mapbox.com/help/#enabling-satellite-imagery

Original comment by bleege on 12 Nov 2013 at 3:11

GoogleCodeExporter commented 8 years ago
I refactored out the code to read the key from the manifest in revision 1386. 
You can use that to prevent duplication.

Original comment by neilboyd on 12 Nov 2013 at 4:36

GoogleCodeExporter commented 8 years ago
I just integrated the MapBoxTileSource file into a personal development fork of 
OSMDroid and refactored the retrieveKey method to use the new ManifestUtil.  
All in all should be good to go.  How would you prefer to proceed?

My fork is at:
https://github.com/bleege/OSMDroid

The MapBoxTileSource is here:
https://github.com/bleege/OSMDroid/blob/master/osmdroid-android/src/main/java/or
g/osmdroid/tileprovider/tilesource/MapBoxTileSource.java

Original comment by bleege on 13 Nov 2013 at 1:55

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I've included this in revision 1387.

I don't think I should add it to TileSourceFactory etc because of the 
limitations of the free plan.

Original comment by neilboyd on 13 Nov 2013 at 8:58

GoogleCodeExporter commented 8 years ago
Awesome!  I'm excited that it's been included in OSMDroid!  Thank you for 
working with me to make this happen.

As for including support with TileSourceFactory and etc, that's totally your 
call as a project owner.  I'd just say that no matter what TileSource provider 
is chosen there's going to be some licensing / terms / limitations that the end 
user / developer needs to accept.  For example, CloudMade also has a monthly 
tile limit and Microsoft has terms of use that need to be agreed to.

Original comment by bleege on 14 Nov 2013 at 2:09

GoogleCodeExporter commented 8 years ago
Bing is already in third-party. I was thinking about doing the same for MapBox, 
but in the end just left it where you put it. Cloudmade has a much higher usage 
allowance in the free plan which is not likely to be exceeded by the sample app.

Original comment by neilboyd on 14 Nov 2013 at 6:42

GoogleCodeExporter commented 8 years ago
Hi,

What's the need of the mapBoxMapId at MapBoxTileSource's constructors as it is 
set only at retrieveMapBoxMapId method ?

Regards.

Original comment by devemu...@gmail.com on 14 Nov 2013 at 11:00

GoogleCodeExporter commented 8 years ago
I removed it in revision 1389

Original comment by neilboyd on 14 Nov 2013 at 2:03

GoogleCodeExporter commented 8 years ago
Ah, I follow you now in regards to the sample app and monthly tile allotment.  
That seems reasonable.

Is there anything else that I can be doing to help move the process along?

Original comment by bleege on 14 Nov 2013 at 3:22

GoogleCodeExporter commented 8 years ago
Is there anything else to do?

Original comment by neilboyd on 14 Nov 2013 at 4:02

GoogleCodeExporter commented 8 years ago
I don't think so.  I just saw that the issue status got set to ReadyForTesting 
and wanted to make sure that you had everything that you needed from me.  How 
does the project's process work from here to official inclusion in the codebase?

Original comment by bleege on 14 Nov 2013 at 4:50

GoogleCodeExporter commented 8 years ago
It's already in the codebase ;)
Whenever I decide to do another release it'll be in.  I pushed a snapshot to 
Maven Central just now.
ReadyForTesting basically means it's finished.

Original comment by neilboyd on 14 Nov 2013 at 8:45

GoogleCodeExporter commented 8 years ago
Fantastic!  Thanks again for helping make this happen!

Original comment by bleege on 14 Nov 2013 at 9:35

GoogleCodeExporter commented 8 years ago

Original comment by neilboyd on 21 Jan 2014 at 8:39