Samples: set user agent for OpenStreetMap provider
https://operations.osmfoundation.org/policies/tiles/
This commit is contained in:
parent
c28aec5f59
commit
c239d8c1b7
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
@ -19,7 +19,6 @@
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.backend.canvas.Canvas;
|
||||
@ -33,12 +32,13 @@ import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.renderer.atlas.TextureAtlas;
|
||||
import org.oscim.renderer.atlas.TextureRegion;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
import org.oscim.utils.TextureAtlasUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -49,9 +49,10 @@ public class AtlasMultiTextureActivity extends MarkerOverlayActivity {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
// Create Atlas from Bitmaps
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2017-2018 devemux86
|
||||
* Copyright 2017-2020 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
|
||||
@ -16,7 +16,6 @@
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.android.cache.TileCache;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
@ -27,6 +26,8 @@ import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class BitmapTileActivity extends MapActivity {
|
||||
|
||||
static final Logger log = LoggerFactory.getLogger(BitmapTileActivity.class);
|
||||
@ -42,6 +43,7 @@ public class BitmapTileActivity extends MapActivity {
|
||||
|
||||
public BitmapTileActivity(BitmapTileSource tileSource) {
|
||||
super(R.layout.activity_map);
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
|
||||
mTileSource = tileSource;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2019 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
@ -22,11 +22,12 @@ import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.layers.marker.*;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||
@ -39,9 +40,10 @@ public class ClusterMarkerOverlayActivity extends MarkerOverlayActivity {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
Bitmap bitmapPoi = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_poi));
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2019 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -33,11 +33,12 @@ import org.oscim.layers.marker.MarkerSymbol;
|
||||
import org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class MarkerOverlayActivity extends MapActivity
|
||||
@ -58,9 +59,10 @@ public class MarkerOverlayActivity extends MapActivity
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
Bitmap bitmapPoi = new AndroidBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.marker_poi));
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2019 Gustl22
|
||||
* Copyright 2020 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
|
||||
@ -15,7 +16,6 @@
|
||||
package org.oscim.android.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||
import org.oscim.layers.tile.buildings.S3DBLayer;
|
||||
@ -25,9 +25,12 @@ import org.oscim.map.Viewport;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
import org.oscim.tiling.source.overpass.OverpassTileSource;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Use Overpass API data for vector layer.
|
||||
* Only for developing as can be error-prone.
|
||||
@ -46,7 +49,7 @@ public class OverpassActivity extends MapActivity {
|
||||
.build();
|
||||
VectorTileLayer l = mMap.setBaseMap(tileSource);
|
||||
|
||||
TileSource bitmapTileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource bitmapTileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.zoomMax(15)
|
||||
.fadeSteps(new BitmapTileLayer.FadeStep[]{
|
||||
@ -54,6 +57,7 @@ public class OverpassActivity extends MapActivity {
|
||||
new BitmapTileLayer.FadeStep(16, Viewport.MAX_ZOOM_LEVEL, 0f, 0f)
|
||||
})
|
||||
.build();
|
||||
bitmapTileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-android-example"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, bitmapTileSource));
|
||||
|
||||
BuildingLayer.RAW_DATA = true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2019 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -41,6 +41,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
|
||||
public class MapLayers {
|
||||
|
||||
@ -183,7 +184,9 @@ public class MapLayers {
|
||||
|
||||
switch (id) {
|
||||
case R.id.menu_layer_openstreetmap:
|
||||
mBackgroundLayer = new BitmapTileLayer(App.map, DefaultSources.OPENSTREETMAP.build());
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mBackgroundLayer = new BitmapTileLayer(App.map, tileSource);
|
||||
break;
|
||||
|
||||
case R.id.menu_layer_naturalearth:
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2017-2019 devemux86
|
||||
* Copyright 2017-2020 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -22,19 +22,22 @@ import org.oscim.core.BoundingBox;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class AnimatorTest extends GdxMapApp {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
MapRenderer.setBackgroundColor(0xff000000);
|
||||
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
mMap.setMapPosition(0, 0, 1 << 4);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
@ -28,12 +28,13 @@ import org.oscim.layers.marker.MarkerSymbol;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.renderer.atlas.TextureAtlas;
|
||||
import org.oscim.renderer.atlas.TextureRegion;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
import org.oscim.utils.TextureAtlasUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -46,9 +47,10 @@ public class AtlasMultiTextureTest extends MarkerLayerTest {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
mMap.setMapPosition(0, 0, 1 << 2);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -20,8 +20,11 @@ import com.badlogic.gdx.Input;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class BitmapTileTest extends GdxMapApp {
|
||||
|
||||
private BitmapTileLayer mLayer = null;
|
||||
@ -33,7 +36,9 @@ public class BitmapTileTest extends GdxMapApp {
|
||||
mMap.layers().remove(mShaded);
|
||||
mShaded = null;
|
||||
mMap.layers().remove(mLayer);
|
||||
mLayer = new BitmapTileLayer(mMap, DefaultSources.OPENSTREETMAP.build());
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mLayer = new BitmapTileLayer(mMap, tileSource);
|
||||
mMap.layers().add(mLayer);
|
||||
mMap.clearMap();
|
||||
return true;
|
||||
@ -64,7 +69,9 @@ public class BitmapTileTest extends GdxMapApp {
|
||||
public void createLayers() {
|
||||
MapRenderer.setBackgroundColor(0xff888888);
|
||||
|
||||
mLayer = new BitmapTileLayer(mMap, DefaultSources.OPENSTREETMAP.build());
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mLayer = new BitmapTileLayer(mMap, tileSource);
|
||||
mMap.layers().add(mLayer);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
@ -22,12 +22,13 @@ import org.oscim.core.GeoPoint;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.marker.*;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ClusterMarkerLayerTest extends MarkerLayerTest {
|
||||
@ -41,9 +42,10 @@ public class ClusterMarkerLayerTest extends MarkerLayerTest {
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
mMap.setMapPosition(53.08, 8.83, 1 << 15);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2014 Hannes Janetzek
|
||||
* Copyright 2016-2019 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -28,12 +28,13 @@ import org.oscim.layers.vector.PathLayer;
|
||||
import org.oscim.layers.vector.geometries.Style;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.renderer.bucket.TextureItem;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class LineTexTest extends GdxMapApp {
|
||||
@ -45,9 +46,10 @@ public class LineTexTest extends GdxMapApp {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
mMap.setMapPosition(0, 0, 1 << 2);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2020 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
|
||||
@ -27,12 +27,13 @@ import org.oscim.layers.marker.MarkerItem;
|
||||
import org.oscim.layers.marker.MarkerSymbol;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.oscim.layers.marker.MarkerSymbol.HotspotPlace;
|
||||
@ -49,9 +50,10 @@ public class MarkerLayerTest extends GdxMapApp implements ItemizedLayer.OnItemGe
|
||||
// Map events receiver
|
||||
mMap.layers().add(new MapEventsReceiver(mMap));
|
||||
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
mMap.setMapPosition(0, 0, 1 << 2);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
* Copyright 2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
@ -30,9 +30,12 @@ import org.oscim.map.Viewport;
|
||||
import org.oscim.theme.VtmThemes;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
import org.oscim.tiling.source.overpass.OverpassTileSource;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Use Overpass API data for vector layer.
|
||||
* Only for developing as can be error-prone.
|
||||
@ -51,7 +54,7 @@ public class OverpassTest extends GdxMapApp {
|
||||
.build();
|
||||
VectorTileLayer l = map.setBaseMap(tileSource);
|
||||
|
||||
TileSource bitmapTileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource bitmapTileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.zoomMax(15)
|
||||
.fadeSteps(new BitmapTileLayer.FadeStep[]{
|
||||
@ -59,6 +62,7 @@ public class OverpassTest extends GdxMapApp {
|
||||
new BitmapTileLayer.FadeStep(16, Viewport.MAX_ZOOM_LEVEL, 0f, 0f)
|
||||
})
|
||||
.build();
|
||||
bitmapTileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, bitmapTileSource));
|
||||
|
||||
BuildingLayer.RAW_DATA = true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -26,11 +26,12 @@ import org.oscim.gdx.GdxMapApp;
|
||||
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.layers.vector.PathLayer;
|
||||
import org.oscim.map.Map.UpdateListener;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class PathLayerTest extends GdxMapApp {
|
||||
@ -41,9 +42,10 @@ public class PathLayerTest extends GdxMapApp {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
mMap.setMapPosition(0, 0, 1 << 2);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -22,18 +22,21 @@ import org.oscim.layers.tile.bitmap.BitmapTileLayer;
|
||||
import org.oscim.layers.vector.VectorLayer;
|
||||
import org.oscim.layers.vector.geometries.PointDrawable;
|
||||
import org.oscim.layers.vector.geometries.Style;
|
||||
import org.oscim.tiling.TileSource;
|
||||
import org.oscim.tiling.source.OkHttpEngine;
|
||||
import org.oscim.tiling.source.UrlTileSource;
|
||||
import org.oscim.tiling.source.bitmap.DefaultSources;
|
||||
import org.oscim.utils.ColorUtil;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class VectorLayerTest extends GdxMapApp {
|
||||
|
||||
@Override
|
||||
public void createLayers() {
|
||||
TileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
UrlTileSource tileSource = DefaultSources.OPENSTREETMAP
|
||||
.httpFactory(new OkHttpEngine.OkHttpFactory())
|
||||
.build();
|
||||
tileSource.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-playground"));
|
||||
mMap.layers().add(new BitmapTileLayer(mMap, tileSource));
|
||||
|
||||
mMap.setMapPosition(0, 0, 1 << 2);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2018 Izumi Kawashima
|
||||
* Copyright 2017-2018 devemux86
|
||||
* Copyright 2017-2020 devemux86
|
||||
* Copyright 2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
@ -23,13 +23,7 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.gwt.GwtApplication;
|
||||
import com.badlogic.gdx.backends.gwt.GwtGraphics;
|
||||
import com.badlogic.gdx.graphics.glutils.GLVersion;
|
||||
|
||||
import org.oscim.backend.AssetAdapter;
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.DateTimeAdapter;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.GL30;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.backend.*;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.gdx.GdxAssets;
|
||||
@ -54,6 +48,8 @@ import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
class GwtMap extends GdxMap {
|
||||
static final Logger log = LoggerFactory.getLogger(GwtMap.class);
|
||||
|
||||
@ -107,9 +103,10 @@ class GwtMap extends GdxMap {
|
||||
|
||||
if ("toner".equals(mapName))
|
||||
ts = DefaultSources.STAMEN_TONER.build();
|
||||
else if ("osm".equals(mapName))
|
||||
else if ("osm".equals(mapName)) {
|
||||
ts = DefaultSources.OPENSTREETMAP.build();
|
||||
else if ("watercolor".equals(mapName))
|
||||
ts.setHttpRequestHeaders(Collections.singletonMap("User-Agent", "vtm-web-app"));
|
||||
} else if ("watercolor".equals(mapName))
|
||||
ts = DefaultSources.STAMEN_WATERCOLOR.build();
|
||||
else if ("ne-landcover".equals(mapName))
|
||||
ts = DefaultSources.NE_LANDCOVER.build();
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 Andrey Novikov
|
||||
* Copyright 2016-2019 devemux86
|
||||
* Copyright 2016-2020 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -35,6 +35,8 @@ public class DefaultSources {
|
||||
new FadeStep(8 - 1, 8 + 1, 0.7f, 0)
|
||||
};
|
||||
|
||||
// Requires a valid HTTP User-Agent identifying application
|
||||
// https://operations.osmfoundation.org/policies/tiles/
|
||||
public static Builder<?> OPENSTREETMAP = BitmapTileSource.builder()
|
||||
.url("https://tile.openstreetmap.org")
|
||||
.zoomMax(18);
|
||||
|
Loading…
x
Reference in New Issue
Block a user