【发布时间】:2022-07-01 00:33:26
【问题描述】:
我正在构建一个包含地图和一些标记的移动应用程序,我发现使用带有 Google API 的 react-native-maps 会花费很多。
我开始使用 MapTiler 托管我自己的地图切片服务器。
我的问题是我找不到可以在 React 原生组件中显示我的地图的库。
这是我的 MapTiler 服务器: 我不知道如何在我的 react native 应用中实现这些光栅图块。
我正在使用世博会。
我应该使用没有任何定价或商业许可的库。 如果您有好的解决方案,请举个例子。
我尝试使用 react-native-maps 但它没有显示任何图块。
<MapView
region={location}
rotateEnabled={false}
style={{ flex: 1 }}
style={styles.map}
showsUserLocation
mapType="none"
>
<UrlTile
tileSize={512}
urlTemplate="http://localhost:3650/api/maps/satellite-hybrid/{z}/{x}/{y}.png"
maximumZ={19}
/>
<Marker
title="Home"
coordinate={{
latitude: location.latitude,
longitude: location.longitude,
}}
/>
</MapView>
【问题讨论】:
标签: react-native expo react-native-maps maptiler