如何将OpenStreetMap集成到本机项目中? [英] How to integrate OpenStreetMap into a react-native project?

查看:127
本文介绍了如何将OpenStreetMap集成到本机项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将OpenStreetMap集成到React Native项目中.但是我在他们的GitHub帐户中找不到任何库或与React Native相关的任何东西.

我唯一能找到的与这些主题相关的东西是下面的链接,其中没有适当的答案.

https://www.reddit.com/r/reactnative/comments/5fi6bg/how_to_add_openstreetmap_to_a_react_native_project/

但是我曾经听说Mapbox使用OpenStreetMap作为其源.Mapbox提出了一种将其集成到React Native项目中的好方法:

https://github.com/mapbox/react-native-mapbox-gl

有没有一种方法可以将OpenStreetMap集成到React Native项目中还是没有适当的支持.

解决方案

您可以在 react-native-maps 包中使用自定义的Tile Overlay(也是OpenStreetMap):their GitHub account.

The only thing I can find relating to these to topics is the link below, in which there is no proper answer.

https://www.reddit.com/r/reactnative/comments/5fi6bg/how_to_add_openstreetmap_to_a_react_native_project/

But I heard once that Mapbox uses OpenStreetMap as their source. Mapbox suggests a good way to integrate it into a React Native project:

https://github.com/mapbox/react-native-mapbox-gl

Is there a way to integrate OpenStreetMap into a React Native project or is it the case there's not proper support for it yet.

解决方案

You can use a custom Tile Overlay (OpenStreetMap too) in react-native-maps package: https://github.com/react-native-maps/react-native-maps

(scroll to Using a custom Tile Overlay section)

You need to add api key. You don't need to use Maps API at all and the key won't be used in that case.

这篇关于如何将OpenStreetMap集成到本机项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆