【问题标题】:Using Address Instead Of Longitude And Latitude With react-native-maps在 react-native-maps 中使用地址而不是经度和纬度
【发布时间】:2017-09-26 06:34:48
【问题描述】:
<MapView

          region={latitude: 28.568806,
                  longitude: 173.765210,
                  latitudeDelta: 0.7,
                  longitudeDelta: 0.7}
          provider={Platform.OS === 'ios' ? PROVIDER_DEFAULT : PROVIDER_GOOGLE }
        >

我想提供区域地址而不是纬度和经度。

【问题讨论】:

    标签: react-native react-native-maps


    【解决方案1】:

    你可以这个链接http://maps.google.com/maps/api/geocode/json?address=

    fetch('http://maps.google.com/maps/api/geocode/json?address=' + 'turkey').then(res => this.setState({region: res.result.geometry.location}));
    

    即你发送地址,它会返回你的json

    【讨论】:

      【解决方案2】:

      你应该使用一些东西来解码 lat,lng 到可读地址我正在使用这个库react-native-geocoder

      【讨论】:

      • 他问的正好相反,如何将“完整地址”转换为“lat and lng”
      猜你喜欢
      • 2013-04-02
      • 2013-02-23
      • 1970-01-01
      • 2016-06-06
      • 2014-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多