Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 使用React Native Geolocation如何让其他用户显示在地图上?_Reactjs_React Native_Geolocation - Fatal编程技术网

Reactjs 使用React Native Geolocation如何让其他用户显示在地图上?

Reactjs 使用React Native Geolocation如何让其他用户显示在地图上?,reactjs,react-native,geolocation,Reactjs,React Native,Geolocation,当前正在为公司创建应用程序。应用程序的用户显示在地图上,他们的宠物也应该显示在地图上@react native community/geolocation为您提供以下信息 coords: { accuracy: 5 altitude: 0 altitudeAccuracy: -1 heading: -1 latitude: 37.7873589 longitude: -122.408227 speed: -1 } 我正在与另一家公司的开发人员合作,他希

当前正在为公司创建应用程序。应用程序的用户显示在地图上,他们的宠物也应该显示在地图上
@react native community/geolocation
为您提供以下信息

coords: {
   accuracy: 5
   altitude: 0
   altitudeAccuracy: -1
   heading: -1
   latitude: 37.7873589
   longitude: -122.408227
   speed: -1
}
我正在与另一家公司的开发人员合作,他希望我提供以下信息,以便发送宠物位置

{
  "bounds": {
    "northeast": {
      "latitude": 0,
      "longitude": 0
    },
    "southwest": {
      "latitude": 0,
      "longitude": 0
    }
  },
  "showVets": true,
  "showSightings": true,
  "showLostPets": true,
  "showDogs": true,
  "showCats": true,
  "showOtherPetTypes": true
}
地理定位不会为您提供
东北
西南
坐标。我不确定该告诉开发人员什么,以便他可以更新API并向我发送正确的信息。任何帮助都将不胜感激

更新:

我试图创建一个函数来生成
东北
西南
坐标

const region = {
    latitude: 37.78825,
    longitude: -122.4324,
    latitudeDelta: 0.0922,
    longitudeDelta: 0.0421,
  }

  const getMapBoundaries = (region) => {
    const northEast = {
      latitude: region.latitude + region.latitudeDelta / 2,
      longitude: region.longitude + region.longitudeDelta / 2
    }
    const southWest = {
      latitude: region.latitude - region.latitudeDelta / 2,
      longitude: region.longitude - region.longitudeDelta / 2
    }

    return {northEast, southWest}
  }

我想我在什么地方。如何改进此函数以获得精确的坐标?

只需为两者发送相同的值即可。听起来他们要求的是一个你可能在其中的矩形范围。你没有一个范围,你有一个确切的位置

{
  "bounds": {
    "northeast": {
      "latitude": 0,
      "longitude": 0
    },
    "southwest": {
      "latitude": 0,
      "longitude": 0
    }
  },
  "showVets": true,
  "showSightings": true,
  "showLostPets": true,
  "showDogs": true,
  "showCats": true,
  "showOtherPetTypes": true
}
否则,您必须与其他开发人员确认您的位置应该有多“模糊”,然后将其添加到两者中


如果你想要宠物或其他东西,那就由你来定义界限。如果你想让所有东西在纬度和经度上偏离你所在位置1度以内,那么东北方向的纬度/经度加1,西南方向的纬度/经度减1。

这就是你的回答。我和另一个开发人员谈过,我想他应该拿我的坐标,并围绕它创建一个半径。我的工作是把用户的职位发给他。