forked from opensciencemap/vtm
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mapbox vector tiles improvements and example #57
- Loading branch information
Showing
6 changed files
with
126 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
vtm-android-example/src/org/oscim/android/test/MapboxMapActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2016 devemux86 | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under the | ||
* terms of the GNU Lesser General Public License as published by the Free Software | ||
* Foundation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.oscim.android.test; | ||
|
||
import android.os.Bundle; | ||
|
||
import org.oscim.layers.tile.buildings.BuildingLayer; | ||
import org.oscim.layers.tile.vector.VectorTileLayer; | ||
import org.oscim.layers.tile.vector.labeling.LabelLayer; | ||
import org.oscim.theme.VtmThemes; | ||
import org.oscim.tiling.source.UrlTileSource; | ||
import org.oscim.tiling.source.mvt.MapboxTileSource; | ||
|
||
public class MapboxMapActivity extends MapActivity { | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
UrlTileSource tileSource = MapboxTileSource.builder() | ||
.apiKey("vector-tiles-xxxxxxx") // Put a proper API key | ||
.build(); | ||
|
||
VectorTileLayer l = mMap.setBaseMap(tileSource); | ||
mMap.setTheme(VtmThemes.MAPZEN); | ||
|
||
mMap.layers().add(new BuildingLayer(mMap, l)); | ||
mMap.layers().add(new LabelLayer(mMap, l)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2016 devemux86 | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under the | ||
* terms of the GNU Lesser General Public License as published by the Free Software | ||
* Foundation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.oscim.test; | ||
|
||
import org.oscim.gdx.GdxMapApp; | ||
import org.oscim.layers.tile.buildings.BuildingLayer; | ||
import org.oscim.layers.tile.vector.VectorTileLayer; | ||
import org.oscim.layers.tile.vector.labeling.LabelLayer; | ||
import org.oscim.theme.VtmThemes; | ||
import org.oscim.tiling.source.UrlTileSource; | ||
import org.oscim.tiling.source.mvt.MapboxTileSource; | ||
|
||
public class MapboxTest extends GdxMapApp { | ||
|
||
@Override | ||
public void createLayers() { | ||
UrlTileSource tileSource = MapboxTileSource.builder() | ||
.apiKey("vector-tiles-xxxxxxx") // Put a proper API key | ||
.build(); | ||
|
||
VectorTileLayer l = mMap.setBaseMap(tileSource); | ||
mMap.setTheme(VtmThemes.MAPZEN); | ||
|
||
mMap.layers().add(new BuildingLayer(mMap, l)); | ||
mMap.layers().add(new LabelLayer(mMap, l)); | ||
} | ||
|
||
public static void main(String[] args) { | ||
GdxMapApp.init(); | ||
GdxMapApp.run(new MapboxTest()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters