我在Bing地图中画了一个圆圈.现在我需要编写一个点(纬度,经度)是在圆圈内部还是外部的代码?
c#.Net中有任何算法代码吗?
我在9000平方公里的区域内拥有大约3500个地理兴趣点,我希望我的应用程序在后台运行,并在他或她接近任何上述点时通知用户.
在Google I/O 2013中引入的新Geofence API似乎非常适合这项工作,特别是因为它针对电池寿命进行了优化,但在获得状态代码GEOFENCE_TOO_MANY_GEOFENCES(使用修改后的版本)之前,我似乎无法注册超过100个地理围栏.演示应用程序).
是否可以增加此限制?也许通过一些设置或API?
我已经使用Flag NEVER_EXPIRE成功添加了地理围栏.一切似乎都运转正常.
但现在测试时我发现如果我停止位置服务地理围栏停止工作作为预期.此外,当我再次启动位置服务时,我之前添加的地理围栏应该再次开始工作,但不会生成任何通知,并且一旦禁用位置服务,地理围栏似乎会自动删除.我必须再次设置所有位置以恢复工作状态下的地理围栏.
任何建议或任何想法为什么它这样做?
编辑::
当设备关闭/重新启动等时也会出现类似的问题.因此,如果禁用位置服务/重新启动设备,基本上所有已注册的地理围栏都将过期.其中很少我尝试通过Session处理,但我正在寻找一种解决方案,通过该解决方案,我们可以在启用位置服务时将Geofences设置回来.
这两者都用作一旦用户进入/退出给定兴趣点就通知的机制.各自的优点和缺点是什么?
我试过搜索,但找不到任何东西.我的问题是" 我如何警告2个或更多用户,如果他们在彼此附近? "在Android中使用地理围栏或其他东西.
说,如果UserA在足球场,而UserB在足球场附近散步.然后UserA和UserB自动获得UserA/UserB在附近的通知.
在Android中更新地理围栏的最佳方法是什么?是先删除旧的Geofences集合,然后像这样添加新更新的列表:
LocationServices.GeofencingApi.removeGeofences(
mGoogleApiClient,
getGeofencePendingIntent()
).setResultCallback(this);
LocationServices.GeofencingApi.addGeofences(
mGoogleApiClient,
getGeofencingRequest(),
getGeofencePendingIntent()
).setResultCallback(this); // Result processed in onResult().
Run Code Online (Sandbox Code Playgroud)
或者我可以直接打电话addGeofences而不删除旧的,并让新的替换旧的?
好的,所以我目前有一个应用程序,我在其中注册使用该CLLocationManager startMonitoringForRegion方法监控的地理围栏.当应用程序位于前台和后台时,此工作正常.
我也有适当的plist值设置:
UIBackgroundModes :{location}
UIRequiredDeviceCapabilities: {location-services}
Run Code Online (Sandbox Code Playgroud)
设备重启后,应用程序未重新启动.如果我startMonitoringSignificantLocationChanges在进入背景之前设置,我可以强制这种情况发生.但是这种方法使用了更多的电池寿命,而且我不需要这个位置,就在我打破地理围栏的时候.
各地区的文件说:
In iOS, the regions you register with the location manager persist between launches of your application. If a region crossing occurs while your iOS app is not running, the system automatically wakes it up (or relaunches it) in the background so that it can process the event. When relaunched, all of the regions you configured previously are made available in the monitoredRegions property of any location …
首先,我的问题与Android中gmap中有关GeoFencing的其他问题略有不同.
当用户开始将圆定义为地理栅栏区域时,我想在屏幕中央显示一个固定的圆圈.在此阶段,用户应该能够移动地图和地图的缩放级别.移动动作和放大/缩小动作都不能改变圆相对于屏幕的大小.
当用户按下保存按钮时,我想将该圆圈作为CircleOption对象固定到地图上.然后我将能够以米为单位获得CircleOption对象的lon/lat和radius.
我目前正在研究RelativeLayout问题.我按照预期绘制了一个带有RelativeLayout的固定圆,但是我无法获得该RelativeLayout圆的当前半径.您可以看到我的RelativeLayout现在的样子:

我不确定这样做的正确方法.我的搜索重定向我使用RelativeLayout然后使用CircleOption.你有什么建议?
提前致谢!
android google-maps android-layout geofencing android-geofence
这是我添加地理围栏的方式:
public void setGeofenceRequest(Location location) {
if (geofences == null) {
geofences = new ArrayList<Geofence>();
}
geofences.add(new Geofence.Builder()
.setRequestId("3")
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_EXIT)
.setCircularRegion(
location.getLatitude(), location.getLongitude(), PSLocationService.getInstance(context).kPSGeofencingDistanceMedium)
.setExpirationDuration(Geofence.NEVER_EXPIRE)
.build());
Intent intent = new Intent(context, ReceiveTransitionsBroadcastReceiver.class);
PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
if (geofences.size() > 0) {
LocationServices.GeofencingApi.addGeofences(mLocationClient, geofences, pi);
Log.i("", "geof autopilot2 will set geofence for autopilot-3");
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的BroadcastReceiver.我应该在哪里收到它们:
public class ReceiveTransitionsBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context ctx, Intent intent) {
Log.i("","autopilot valid geof on receive transisionts broadcast receiver"); …Run Code Online (Sandbox Code Playgroud) android location broadcastreceiver geofencing android-geofence
我正在尝试使用传单进行地理围栏,并且我有一个可以移动的标记和一个在地图上的圆圈。
这是完整的代码:
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<head>
<link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-locatecontrol/v0.43.0/css/font-awesome.min.css' rel='stylesheet' />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>
</head>
<body>
<div id="mapid" style="height: 600px"></div>
<script>
var mymap = L.map('mapid', {
center: [50.897819, -1.150189],
zoom: 16
});
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1Ijoic3RldmVuc2F0Y2giLCJhIjoiY2p5eDR6MWgzMHRvbjNocnJkN2d2MjRwaSJ9.wd0OtBUQQfUtNxdduQA3lg', {
maxZoom: 18,
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: 'mapbox.streets'
}).addTo(mymap);
var marker = new L.marker([50.898422, -1.148444],{
draggable: true,
autoPan: true
}).addTo(mymap);
var circle = …Run Code Online (Sandbox Code Playgroud) geofencing ×10
android ×7
geolocation ×2
location ×2
bing-maps ×1
c# ×1
google-maps ×1
ios ×1
javascript ×1
leaflet ×1
maps ×1
proximity ×1