高德地图调整和添加高德交通图层
Showing
3 changed files
with
48 additions
and
19 deletions
... | @@ -11,6 +11,8 @@ import com.esri.android.map.LocationDisplayManager; | ... | @@ -11,6 +11,8 @@ import com.esri.android.map.LocationDisplayManager; |
11 | import com.esri.android.map.MapView; | 11 | import com.esri.android.map.MapView; |
12 | import com.esri.android.runtime.ArcGISRuntime; | 12 | import com.esri.android.runtime.ArcGISRuntime; |
13 | import com.esri.core.geometry.Point; | 13 | import com.esri.core.geometry.Point; |
14 | import com.pashanhoo.landsurvey.layers.gaode.GaodeMapLayerTypes; | ||
15 | import com.pashanhoo.landsurvey.layers.gaode.GaodeMapsTiledServiceLayer; | ||
14 | import com.pashanhoo.landsurvey.layers.geoq.GeoQMapLayerTypes; | 16 | import com.pashanhoo.landsurvey.layers.geoq.GeoQMapLayerTypes; |
15 | import com.pashanhoo.landsurvey.layers.geoq.GeoQMapsTiledServiceLayer; | 17 | import com.pashanhoo.landsurvey.layers.geoq.GeoQMapsTiledServiceLayer; |
16 | import com.pashanhoo.landsurvey.layers.google.GoogleMapLayerTypes; | 18 | import com.pashanhoo.landsurvey.layers.google.GoogleMapLayerTypes; |
... | @@ -42,11 +44,20 @@ public class GoogleMapActivity extends AppCompatActivity { | ... | @@ -42,11 +44,20 @@ public class GoogleMapActivity extends AppCompatActivity { |
42 | // mapView.addLayer(GOOGLE_IMAGE_Layer); | 44 | // mapView.addLayer(GOOGLE_IMAGE_Layer); |
43 | // GoogleMapsTiledServiceLayer GOOGLE_ANNO_Layer = new GoogleMapsTiledServiceLayer(GoogleMapLayerTypes.IMAGE_ANNO_GOOGLE_MAP); | 45 | // GoogleMapsTiledServiceLayer GOOGLE_ANNO_Layer = new GoogleMapsTiledServiceLayer(GoogleMapLayerTypes.IMAGE_ANNO_GOOGLE_MAP); |
44 | // mapView.addLayer(GOOGLE_ANNO_Layer); | 46 | // mapView.addLayer(GOOGLE_ANNO_Layer); |
45 | GoogleMapsTiledServiceLayer OSM_Layer = new GoogleMapsTiledServiceLayer(GoogleMapLayerTypes.OSM_Map); | 47 | // GoogleMapsTiledServiceLayer OSM_Layer = new GoogleMapsTiledServiceLayer(GoogleMapLayerTypes.OSM_Map); |
46 | mapView.addLayer(OSM_Layer); | 48 | // mapView.addLayer(OSM_Layer); |
47 | 49 | ||
48 | // GaodeMapsTiledServiceLayer gaodeMapsTiledServiceLayer = new GaodeMapsTiledServiceLayer(GaodeMapLayerTypes.VECTOR_Gaode_MAP); | 50 | //--------------------------------------------------------------------------------------------------------------------- |
49 | // mapView.addLayer(gaodeMapsTiledServiceLayer); | 51 | // 高德矢量图层(含路网,含注记) |
52 | GaodeMapsTiledServiceLayer gaodeMapsTiledServiceLayer = new GaodeMapsTiledServiceLayer(GaodeMapLayerTypes.AMAP_VECTOR); | ||
53 | // 高德影像图层(不含路网,不含注记) | ||
54 | // GaodeMapsTiledServiceLayer gaodeMapsTiledServiceLayer = new GaodeMapsTiledServiceLayer(GaodeMapLayerTypes.AMAP_IMAGE); | ||
55 | // 高德路网图层(含路网,含注记) | ||
56 | // GaodeMapsTiledServiceLayer gaodeMapsTiledServiceLayer = new GaodeMapsTiledServiceLayer(GaodeMapLayerTypes.AMAP_ROAD); | ||
57 | // 高德实时交通图层 | ||
58 | // GaodeMapsTiledServiceLayer gaodeMapsTiledServiceLayer = new GaodeMapsTiledServiceLayer(GaodeMapLayerTypes.AMAP_TRAFFIC); | ||
59 | mapView.addLayer(gaodeMapsTiledServiceLayer); | ||
60 | //--------------------------------------------------------------------------------------------------------------------- | ||
50 | 61 | ||
51 | // GeoQMapsTiledServiceLayer geoQMapsTiledServiceLayer = new GeoQMapsTiledServiceLayer(GeoQMapLayerTypes.ChinaOnlineCommunity_Mobile); | 62 | // GeoQMapsTiledServiceLayer geoQMapsTiledServiceLayer = new GeoQMapsTiledServiceLayer(GeoQMapLayerTypes.ChinaOnlineCommunity_Mobile); |
52 | // mapView.addLayer(geoQMapsTiledServiceLayer); | 63 | // mapView.addLayer(geoQMapsTiledServiceLayer); | ... | ... |
... | @@ -3,16 +3,22 @@ package com.pashanhoo.landsurvey.layers.gaode; | ... | @@ -3,16 +3,22 @@ package com.pashanhoo.landsurvey.layers.gaode; |
3 | import com.pashanhoo.landsurvey.layers.BaseTiledMapServiceType; | 3 | import com.pashanhoo.landsurvey.layers.BaseTiledMapServiceType; |
4 | 4 | ||
5 | public enum GaodeMapLayerTypes implements BaseTiledMapServiceType { | 5 | public enum GaodeMapLayerTypes implements BaseTiledMapServiceType { |
6 | 6 | /** | |
7 | /** * Google vector map service by city map*/ | 7 | * 高德矢量图层(含路网,含注记) |
8 | VECTOR_Gaode_MAP, | 8 | */ |
9 | 9 | AMAP_VECTOR, | |
10 | /** * Google image map service by satellite map */ | 10 | /** |
11 | IMAGE_Gaode_MAP, | 11 | * 高德影像图层(不含路网,不含注记) |
12 | 12 | */ | |
13 | Anno_Gaode_Map; | 13 | AMAP_IMAGE, |
14 | /** * Google topographic map service ======= topographic map */ | 14 | /** |
15 | /** * Google road POI map service = = = = net road map */ | 15 | * 高德路网图层(含路网,含注记) |
16 | */ | ||
17 | AMAP_ROAD, | ||
18 | /** | ||
19 | * 高德实时交通图层 | ||
20 | */ | ||
21 | AMAP_TRAFFIC; | ||
16 | 22 | ||
17 | @Override | 23 | @Override |
18 | public String getName() | 24 | public String getName() | ... | ... |
... | @@ -17,6 +17,8 @@ import com.pashanhoo.landsurvey.layers.google.GoogleMapLayerTypes; | ... | @@ -17,6 +17,8 @@ import com.pashanhoo.landsurvey.layers.google.GoogleMapLayerTypes; |
17 | import com.pashanhoo.landsurvey.utils.AppInfo; | 17 | import com.pashanhoo.landsurvey.utils.AppInfo; |
18 | import com.pashanhoo.landsurvey.utils.GADBHelper; | 18 | import com.pashanhoo.landsurvey.utils.GADBHelper; |
19 | 19 | ||
20 | import java.util.Calendar; | ||
21 | import java.util.TimeZone; | ||
20 | import java.util.concurrent.RejectedExecutionException; | 22 | import java.util.concurrent.RejectedExecutionException; |
21 | 23 | ||
22 | /** | 24 | /** |
... | @@ -135,15 +137,25 @@ public class GaodeMapsTiledServiceLayer extends TiledServiceLayer { | ... | @@ -135,15 +137,25 @@ public class GaodeMapsTiledServiceLayer extends TiledServiceLayer { |
135 | String url = ""; | 137 | String url = ""; |
136 | String s = "Galil"; | 138 | String s = "Galil"; |
137 | switch (gaodeMapLayerTypes) { | 139 | switch (gaodeMapLayerTypes) { |
138 | case VECTOR_Gaode_MAP: | 140 | case AMAP_VECTOR: |
139 | url= "http://webrd01.is.autonavi.com/appmaptile?&x=" + col + "&y=" + row + "&z=" + level + "&lang=zh_cn&size=1&scale=1&style=7"; | 141 | url= "http://webrd01.is.autonavi.com/appmaptile?&x=" + col + "&y=" + row + "&z=" + level + |
142 | "&lang=zh_cn&size=1&scale=1&style=7"; | ||
140 | break; | 143 | break; |
141 | case IMAGE_Gaode_MAP: | 144 | case AMAP_IMAGE: |
142 | url = "http://webst02.is.autonavi.com/appmaptile?style=6&x="+col+"&y="+row+"&z="+level; | 145 | url = "http://webst02.is.autonavi.com/appmaptile?style=6&x="+col+"&y="+row+"&z="+level; |
143 | break; | 146 | break; |
144 | case Anno_Gaode_Map: | 147 | case AMAP_ROAD: |
145 | url = "http://webst02.is.autonavi.com/appmaptile?style=8&x=" + col + "&y=" + row + "&z=" + level; | 148 | url = "http://webst02.is.autonavi.com/appmaptile?style=8&x=" + col + "&y=" + row + "&z=" + level; |
146 | break; | 149 | break; |
150 | case AMAP_TRAFFIC: | ||
151 | Calendar calendar = Calendar.getInstance(); | ||
152 | calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00")); | ||
153 | int day = calendar.get(Calendar.DAY_OF_WEEK); | ||
154 | int hh = calendar.get(Calendar.HOUR_OF_DAY); | ||
155 | int mm = calendar.get(Calendar.MINUTE); | ||
156 | url = "http://history.traffic.amap.com/traffic?type=2" + "&day=" + day + "&hh=" + hh + "&mm=" + mm | ||
157 | + "&x=" + col + "&y=" + row + "&z=" + level; | ||
158 | break; | ||
147 | } | 159 | } |
148 | 160 | ||
149 | try { | 161 | try { | ... | ... |
-
Please register or sign in to post a comment