osgEarth的Rex引擎原理分析(七十九)如何加载百度、高德、谷歌、微软的在线地图

本文介绍了如何使用osgEarth加载不同地图服务商的在线地图,包括百度、高德、谷歌和微软的地图瓦片。详细分析了各地图服务商的瓦片编号规则,如谷歌XYZ、TMS、QuadTree和百度XYZ,并提供了各种地图的URL示例。同时,文章探讨了高德地图瓦片加载的特殊性和注意事项,如参数设置、瓦片顺序和转换方法。
摘要由CSDN通过智能技术生成

目标:(七十八)中的问题155

瓦片生成后,就是一堆图片。怎么对这堆图片进行编号,是目前主流互联网地图商分歧最大的地方。总结起来分为四个流派:

  • 谷歌XYZ:Z表示缩放层级,Z=zoom;XY的原点在左上角,X从左向右,Y从上向下。
  • TMS:开源产品的标准,Z的定义与谷歌相同;XY的原点在左下角,X从左向右,Y从下向上。腾讯地图是严格按照这个来的,只不过最小层级为3,也即z从3开始起算,0、1、2是读不到内容的,比如中国范围就是http://rt1.map.gtimg.com/realtimerender?z=3&x=6&y=4&type=vector&style=0
  • QuadTree:微软Bing地图使用的编码规范,Z的定义与谷歌相同,同一层级的瓦片不用XY两个维度表示,而只用一个整数表示,该整数服从四叉树编码规则
  • 百度XYZ:Z从1开始,在最高级就把地图分为四块瓦片;XY的原点在经度为0纬度位0的位置,X从左向右,Y从下向上。

下图显示了前三个流派在zoom=1层级上的瓦片编号结果:

clipboard.png

 高德地图的瓦片划分方式

下表总结了中国主要地图商的瓦片编号流派,点击每个链接就可以获得一个对应编号的瓦片地图:

地图商 瓦片编码 图层 链接
高德地图 谷歌XYZ 道路 http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x=105&y=48&z=7
高德地图 谷歌XYZ 卫星 http://webst04.is.autonavi.com/appmaptile?style=6&x=843&y=388&z=10
谷歌地图 谷歌XYZ 道路 http://mt2.google.cn/vt/lyrs=m&hl=zh-CN&gl=cn&x=105&y=48&z=7
谷歌地图 谷歌XYZ 卫星 http://mt2.google.cn/vt/lyrs=s&hl=zh-CN&gl=cn&x=105&y=48&z=7
谷歌地图 谷歌XYZ 地形

http://mt0.google.cn/vt/lyrs=t&hl=zh-CN&gl=cn&x=420&y=193&z=9

谷歌地球的数据,类似kh.google.com/flatfile?f1c-0210332-t.873,这是经过处理的,具体解析方法可以参考Google Earth影像数据破解之旅 - fu*k - 博客园和cesium

OpenStreetMap 谷歌XYZ 道路 http://a.tile.openstreetmap.org/7/105/48.png
腾讯地图 TMS 道路

http://rt1.map.gtimg.com/realtimerender?z=7&x=105&y=79&type=vector&style=0

注:osgEarth中tms不是这样用的,而是http://readymap.org/readymap/tiles/1.0.0/7/,tms驱动会将xyz添加在链接后面,这里应该是以xyz的方式去获取tms瓦片

Bing地图 QuadTree 道路 http://r1.tiles.ditu.live.com/tiles/r1321001.png?g=100&mkt=zh-cn
百度地图 百度XYZ 道路 http://online4.map.bdimg.com/tile/?qt=tile&x=98&y=36&z=9&;styles=pl&scaler=1&udt=20170406
百度地图 百度XYZ 交通 http://its.map.baidu.com:8002/traffic/TrafficTileService?level=19&x=99052&y=20189&time=1373790856265&label=web2D&;v=017

谷歌地图中:z即为瓦片的层次,0层覆盖全球;y为行,从上往下为0~2^z-1;x为列,从左往右依次为0~2^z-1

地址中mt0.google.cn为服务器地址,可用的包括mt1.google.cn、mt2.google.cn、mt3.google.cn等。

lyrs=s为地图类型,如下:

  • m:路线图
  • t:地形图
  • p:带标签的地形图
  • s:卫星图
  • y:带标签的卫星图
  • h:标签层(路名、地名等)

补充一个新的瓦片地图资源:http://map.geoq.cn/,里面有彩色、灰色、暖色和夜色版的中国地图,坐标为GCJ02。举例:http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetWarm/MapServer/tile/{z}/{y}/{x}

earth文件配置和效果如下:

<map name="MBTiles" type="geocentric" version="2"> 
	  <options>
			<profile>
          <srs>wgs84</srs>
          <xmin>-180.0</xmin>
          <ymin>-90.0</ymin>
          <xmax>180.0</xmax>
          <ymax>90.0</ymax>
        	<num_tiles_wide_at_lod_0>1</num_tiles_wide_at_lod_0>
			  	<num_tiles_high_at_lod_0>1</num_tiles_high_at_lod_0>  
      </profile>    
      <terrain driver="rex" color="#0000ffff">
      	<vertical_scale>1.0</vertical_scale>
      </terrain>
    </options>

		<image name="mapbox_satellite" driver="xyz">
        <url>http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetWarm/MapServer/tile/{z}/{y}/{x}</url>
        <profile>
          <srs>wgs84</srs>
          <xmin>-180.0</xmin>
          <ymin>-90.0</ymin>
          <xmax>180.0</xmax>
          <ymax>90.0</ymax>
        	<num_tiles_wide_at_lod_0>1</num_tiles_wide_at_lod_0>
			  	<num_tiles_high_at_lod_0>1</num_tiles_high_at_lod_0>  
        </profile>             
	  </image>


 

1) http://online0.map.bdimg.com/onlinelabel/?qt=tile&x=49310&y=10244&z=18
2) http://online1.map.bdimg.com/onlinelabel/?qt=tile&x=49310&y=10244&z=18
3) http://online2.map.bdimg.com/onlinelabel/?qt=tile&x=49310&y=10244&z=18
4) http://online3.map.bdimg.com/onlinelabel/?qt=tile&x=49310&y=10244&z=18
5) http://online4.map.bdimg.com/onlinelabel/?qt=tile&x=49310&y=10244&z=18
6) http://online5.map.bdimg.com/onlinelabel/?qt=tile&x=49310&y=10244&z=18
7) http://online6.map.bdimg.com/onlinelabel/?qt=tile&x=49310&y=10244&z=18
8) http://online7.map.bdimg.com/onlinelabel/?qt=tile&x=49310&y=10244&z=18
9) http://online8.map.bdimg.com/onlinelabel/?qt=tile&x=49310&y=10244&z=18
10) http://online9.map.bdimg.com/onlinelabel/?qt=tile&x=49310&y=10244&z=18
11) http://map.baidu.com/
12) http://wprd01.is.autonavi.com/appmaptile?style=7&x=427289&y=227618&z=19
13) http://wprd02.is.autonavi.com/appmaptile?style=7&x=427289&y=227618&z=19
14) http://wprd03.is.autonavi.com/appmaptile?style=7&x=427289&y=227618&z=19
15) http://wprd04.is.autonavi.com/appmaptile?style=

osgEarth 的 121 个案例详解 osgEarth 的 121 个案例详解 ...........................................................................................................1 1. aeqd.earth.................................................................................................................................4 2. annotation.earth .......................................................................................................................5 3. annotation_dateline.earth........................................................................................................6 4. annotation_dateline_projected.earth ......................................................................................8 5. annotation_flat.earth................................................................................................................8 6. arcgisonline.earth .....................................................................................................................9 7. bing.earth................................................................................................................................10 8. boston.earth............................................................................................................................11 9. boston_buildings.earth ...........................................................................................................12 10. boston_projected.earth ..................................................................................................13 11. boston_tfs.earth..............................................................................................................14 12. boston-gpu.earth ............................................................................................................15 13. bumpmap.earth ..............................................................................................................16 14. clouds.earth ....................................................................................................................17 15. colorramp.earth ..............................................................................................................18 16. contourmap.earth ...........................................................................................................19 17. datum_override.earth.....................................................................................................20 18. day_night_mp.earth........................................................................................................21 19. day_night_rex.earth........................................................................................................21 20. detail_texture.earth ........................................................................................................21 21. errors.earth .....................................................................................................................22 22. fade_elevation.earth.......................................................................................................22 23. feature_clip_plane.earth.................................................................................................23 24. feature_country_boundaries.earth.................................................................................24 25. feature_custom_filters.earth ..........................................................................................25 26. feature_draped_lines.earth ............................................................................................26 27. feature_draped_polygons.earth .....................................................................................27 28. feature_elevation.earth ..................................................................................................28 29. feature_extrude.earth.....................................................................................................29 30. feature_geom.earth ........................................................................................................30 31. feature_gpx.earth............................................................................................................31 32. feature_inline_geometry.earth.......................................................................................32 33. feature_labels.earth........................................................................................................33 34. feature_labels_script.earth.............................................................................................35 35. feature_levels_and_selectors.earth................................................................................35 36. feature_model_scatter.earth ..........................................................................................36 37. feature_models.earth .....................................................................................................37 38. feature_occlusion_culling.earth......................................................................................38osgEarth 编辑器 SXEarth www.sxsim.com 2 39. feature_offset_polygons.earth .......................................................................................38 40. feature_overlay.earth......................................................................................................39 41. feature_poles.earth.........................................................................................................40 42. feature_population_cylinders.earth ...............................................................................40 43. feature_raster.earth ........................................................................................................41 44. feature_rasterize.earth ...................................................................................................41 45. feature_rasterize_2.earth ...............................................................................................42 46. feature_scripted_styling.earth........................................................................................43 47. feature_scripted_styling_2.earth....................................................................................43 48. feature_scripted_styling_3.earth....................................................................................43 49. feature_style_selector.earth ...........................................................................................44 50. feature_tfs.earth .............................................................................................................45 51. feature_tfs_scripting.earth .............................................................................................46 52. feature_wfs.earth............................................................................................................47 53. fractal_elevation.earth....................................................................................................47 54. gdal_multiple_files.earth ................................................................................................47 55. gdal_tiff.earth..................................................................................................................48 56. geomshader.earth ...........................................................................................................49 57. glsl.earth..........................................................................................................................50 58. glsl_filter.earth ................................................................................................................51 59. graticules.earth ...............................................................................................................52 60. hires-inset.earth..............................................................................................................53 61. intersect_filter.earth .......................................................................................................54 62. land_cover_mixed.earth .................................................................................................55 63. layer_opacity.earth .........................................................................................................55 64. ldb.earth..........................................................................................................................56 65. mapbox.earth..................................................................................................................56 66. mask.earth ......................................................................................................................57 67. mb_tiles.earth.................................................................................................................58 68. mercator_to_plate_carre.earth ......................................................................................59 69. mgrs_graticule.earth.......................................................................................................60 70. min_max_level.earth ......................................................................................................60 71. min_max_range.earth.....................................................................................................61 72. min_max_range_rex.earth..............................................................................................62 73. min_max_resolutions.earth............................................................................................62 74. multiple_heightfields.earth.............................................................................................64 75. night.earth.......................................................................................................................65 76. nodata.earth ...................................................................................................................65 77. noise.earth ......................................................................................................................68 78. normalmap.earth ............................................................................................................68 79. ocean.earth .....................................................................................................................69 80. ocean_no_elevation.earth ..............................................................................................69 81. openstreetmap.earth......................................................................................................69 82. openstreetmap_buildings.earth .....................................................................................70osgEarth 编辑器 SXEarth www.sxsim.com 3 83. openstreetmap_flat.earth...............................................................................................70 84. openstreetmap_full.earth...............................................................................................70 85. openweathermap_clouds.earth......................................................................................71 86. openweathermap_precipitation.earth ...........................................................................71 87. openweathermap_pressure.earth ..................................................................................71 88. photosphere1.earth ........................................................................................................71 89. photosphere2.earth ........................................................................................................72 90. readymap.earth...............................................................................................................73 91. readymap_flat.earth .......................................................................................................73 92. readymap_include.earth.................................................................................................74 93. readymap_template.earth..............................................................................................74 94. readymap-elevation-only.earth.......................................................................................74 95. readymap-osm.earth ......................................................................................................75 96. readymap-priority.earth..................................................................................................75 97. readymap-rex.earth ........................................................................................................75 98. roads.earth......................................................................................................................76 99. roads-flattened.earth......................................................................................................76 100. roads-test.earth...............................................................................................................76 101. scene_clamping.earth.....................................................................................................76 102. silverlining.earth..............................................................................................................78 103. simple_model.earth........................................................................................................78 104. skyview1.earth ................................................................................................................79 105. skyview2.earth ................................................................................................................80 106. splat.earth .......................................................................................................................81 107. splat-blended-with-imagery.earth ..................................................................................81 108. splat-with-mask-layer.earth.............................................................................................81 109. splat-with-multiple-zones.earth......................................................................................82 110. splat-with-rasterized-land-cover.earth............................................................................82 111. stamen_toner.earth ........................................................................................................82 112. stamen_watercolor.earth................................................................................................82 113. state_plane.earth............................................................................................................82 114. tess_screen_space.earth.................................................................................................82 115. tess-coastlines.earth .......................................................................................................82 116. tess-terrain.earth ............................................................................................................83 117. triton.earth......................................................................................................................83 118. triton_drop_shader.earth................................................................................................83 119. utm.earth ........................................................................................................................83 120. utm_graticule.earth ........................................................................................................83 121. vertical_datum.earth ......................................................................................................83 122. wms_nexrad.earth ..........................................................................................................84 123. wms-t_nexrad_animated.earth ......................................................................................84 124. 编辑问题总结....................................................................................错误!未定义书签。
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值