(OFF Line MAP) how to download osm tiles to use OFF LINE MAP in react-native-maps

社会主义新天地 提交于 2020-06-23 18:48:04

问题


Respected sir/ma'am I want to implement offline osm map in my project. but i don't found any proper documentation for how to download tiles for offline usage. i am currently using react-native-maps package for implementing custom Tile Overlay

import { LocalTile } from 'react-native-maps';

<MapView
  region={this.state.region}
  onRegionChange={this.onRegionChange}
>
  <LocalTile
   /**
    * The path template of the locally stored tiles. The patterns {x} {y} {z} will be replaced at runtime
    * For example, /storage/emulated/0/mytiles/{z}/{x}/{y}.png
    */
   pathTemplate={this.state.pathTemplate}
   /**
    * The size of provided local tiles (usually 256 or 512).
    */
   tileSize={256}
  />
</MapView>

回答1:


There is no straightforward approach for downloading offline raster tiles for OSM. Rendering these tiles is very resource intensive and depending on the zoom level the download and storage size of raster tiles will become huge. In other words: raster tiles should be avoided for offline use. You should consider using vector tiles instead.

Possible solutions:

  • Render your own raster tiles, for example by using Maperitive
  • Switch to a library supporting vector tiles and download them, for example from OpenMapTiles.com


来源:https://stackoverflow.com/questions/62149188/off-line-map-how-to-download-osm-tiles-to-use-off-line-map-in-react-native-map

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!