代码之家  ›  专栏  ›  技术社区  ›  Samiksha Jagtap

在react本地地图中使用地址而不是经度和纬度

  •  1
  • Samiksha Jagtap  · 技术社区  · 7 年前
    <MapView
    
              region={latitude: 28.568806,
                      longitude: 173.765210,
                      latitudeDelta: 0.7,
                      longitudeDelta: 0.7}
              provider={Platform.OS === 'ios' ? PROVIDER_DEFAULT : PROVIDER_GOOGLE }
            >
    

    2 回复  |  直到 7 年前
        1
  •  1
  •   Batu    7 年前

    你可以点击这个链接 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}));
    

    enter image description here

    也就是说,你发送地址,它将返回你的json

        2
  •  -1
  •   Ahmed Ali    7 年前