Tag: geolocation

如何使用C#将HTML5 GeoLocationfunction用于WinForms的GeckoFX v22 Web浏览器控件?

我想实现一个Web浏览器控件到Geo-location启用我的WinForm桌面应用程序。 我已经在WinForm项目中成功实现了GeckoFX Web浏览器。 问题是访问启用HTML5 Gelocation的网站/地址时,不会出现“允许/拒绝访问”弹出窗口。 因此,地理位置不起作用。 我已经确认在首选项中启用了地理位置,并使用http://html5test.com测试了我的WinForm,并且该控件被列为支持地理位置。 我已经尝试通过XPCom API为特定域设置权限,以便不需要弹出请求权限: //CREATE nsSTRING nsAUTF8String i = new nsAUTF8String(“http://html5demos.com”); //CREATE NEW URI var nsII = Xpcom.CreateInstance(“@mozilla.org/network/io-service;1”); nsIURI uri = nsII.NewURI(i, “Unicode”, null); //CREATE PERMISSION MANAGER var instancePM = Xpcom.CreateInstance(“@mozilla.org/permissionmanager;1”); //GEO PERMISSION SETTINGS uint permission = Convert.ToUInt32(1); uint expiretype = Convert.ToUInt32(0); long expireTime = (long)0; //ADD GEO PERMISSION SETTINGS […]

我需要哪些经度/纬度调整才能将地图放大到西北和东南?

这与我之前的问题有关 我想在我的地图上添加一个“垫片”,以便极端的图钉不是半边界,半边界。 我走在正确的轨道上(没有双关语),但我的逻辑是错误的。 我写了这个方法: // Adapted from Brundritt and Boonaert: https://stackoverflow.com/questions/26937358/can-i-adjust-my-bing-maps-view-locationrect-bounding-box-by-a-small-amount public static Location GetAShimLocation(IList locations, bool IsForNorthwestCorner) { const double MAP_CUSHION = 0.1; // Is this a comfortable enough cushion? // I don’t know why the Lats are 85 instead of 90 double maxLat = -85; double minLat = 85; double maxLon = -180; […]

Windows Phone GeoCoordinateWatcher上相同物理位置的不同GPS位置读取

我正在使用Windows Phone GeoWatcher这样的坐标 private GeoCoordinateWatcher _watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High); _watcher.MovementThreshold = 2; // Threshold Value _watcher.PositionChanged += Watcher_PositionChanged; //Registering Watcher Position Change Event _watcher.Start(); // Starting Watcher //Watcher position Change Event private void Watcher_PositionChanged(object sender, GeoPositionChangedEventArgs e) { var coord = new GeoCoordinate(Convert.ToDouble(e.Position.Location.Latitude.ToString(“0.00000”).Replace(“,”, “.”)), Convert.ToDouble(e.Position.Location.Longitude.ToString(“0.00000”).Replace(“,”, “.”))); } 但是我在同一个地方得到不同的经度和纬度值,即使我没有移动,我也设置了阈值。 如果我没有错,那么阈值就意味着如果你至少覆盖那么多的距离,它就会给你新的坐标。 由于当我静止不动时同一个地方的坐标值不同,我的应用程序在距离检查上失败了。 因为它为两个坐标返回一个非零距离,并且在realality中我没有移动。 这是我在同一地点捕获的惠斯特的一些读数。 为了更好的分析,我删除了一些0距离条目。 Previous POint […]

从对象类型System.Data.Spatial.DbGeography到已知的托管提供程序本机类型不存在映射

我正在使用DotNetNuke 7平台构建应用程序,并尝试将地理数据写入数据库。 以下是该项目的一些背景知识。 我在VS 2012中构建,刚刚从2008 R2升级到Server 2012。 DotNetNuke 7为数据层和WebAPI实现了PetaPoco。 我希望我提供的信息足以让我们了解问题。 我的代码在“rep.Insert(location);”行上失败了 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Net; using System.Web; using System.Net.Http; using System.Web.Http; using System.Data.Spatial; using DotNetNuke.Web.Api; using DotNetNuke.Data; namespace DotNetNuke.Modules.GeoLocations { public class LocationController: DnnApiController { [AllowAnonymous] [HttpPost] [ValidateAntiForgeryToken] public HttpResponseMessage addLocation(CP_Location submitted) { submitted.GeoCode = DbGeography.PointFromText(string.Format(“POINT({0} {1})”, submitted.Long, submitted.Lat), […]

应用程序在调试时不会崩溃,但在正常运行时会发生

系统信息 Windows 10技术预览版(内部版本9926) Visual Studio社区2013 试图调试: [AT&T] Lumia 635(Windows 10技术预览版手机内置9941瓦特/ Lumia Cyan) [AT&T] Lumia 1520(带有Lumia Denim和PfD的Windows Phone 8.1) [Unlocked] BLU Win Jr(Windows Phone 8.1 with PfD) [Verizon] Lumia Icon(带有Lumia Denim和PfD的Windows Phone 8.1) 我试图在我的应用程序中使用位置服务。 以前,我有Visual Studio抛出错误。 这是一个ArgumentException ,消息“ Use of undefined keyword value 1 for event TaskScheduled in async ”。 谷歌搜索没有找到任何解决方案。 这是代码: Geolocator Locator = new […]

给定坐标,我如何获得半径10英里范围内的所有邮政编码?

我有一个位置(纬度和经度)。 如何获得部分或完全位于我所在位置10英里范围内的邮政编码列表? 解决方案可以是调用众所周知的Web服务(谷歌地图,bing地图等)或本地数据库解决方案(客户端具有sql server 2005)或算法。 我已经看到了类似的问题 ,但是那里的所有答案几乎都与使用我无法使用的SQL Server 2008地理function有关。

C#中的地理位置

我正在尝试开发一个应该像游戏一样的应用程序。 用户在城市中会有一些位置,他必须在每个位置做一些事情。 为了跟踪用户的位置,我尝试使用以下代码进行地理定位: Geolocator geolocator = new Geolocator(); //geolocator.DesiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.High; geolocator.DesiredAccuracyInMeters = 50; try { Geoposition geoposition = await geolocator.GetGeopositionAsync(TimeSpan.FromMilliseconds(500), TimeSpan.FromSeconds(1)); textLatitude.Text = “Latitude: ” + geoposition.Coordinate.Latitude.ToString(“0.0000000000”); textLongitude.Text = “Longitude: ” + geoposition.Coordinate.Longitude.ToString(“0.0000000000”); textAccuracy.Text = “Accuracy: ” + geoposition.Coordinate.Accuracy.ToString(“0.0000000000”); } 使用以下方法获取坐标,我试图测试设备是否将使用以下代码正确定位我的位置: if( Math.Abs(geoposition.Coordinate.Latitude – 45.3285) < 0.001 ){ if (Math.Abs(geoposition.Coordinate.Longitude – 14.4474) < 0.001) […]

检查点是否在圆圈内

我有一个用lat / long表示的点 Position louvreMuseum = new Position( 48.861622, 2.337474 ); 我有一个以米为单位的半径值。 我需要检查另一个点,也用lat / long表示,是否在圆圈内。 如果我在平坦的表面上,我可以简单地使用公式 (x – center_x)^2 + (y – center_y)^2 <= radius^2 正如在这些SO答案中深刻解释的那样 然而,由于纬度/经度的使用,我不能使用该公式,因为行星的球形性质。 如何计算从任何给定点到中心的距离与半径进行比较?

哪个DLL具有Windows.Devices.Gelocation命名空间?

我正在使用VS 2012,我需要编写使用Windows.Devices.Gelocation命名空间中的类的代码。 我下载了示例程序,但它不会在VS2012中加载,因为它需要VS 2013.并且该类的文档不指示命名空间所在的DLL。 有人能告诉我哪个DLL包含该命名空间吗? 它是否可以在.NET 4中使用,还是必须使用.NET 4.5? 编辑 我的项目是一个控制台应用程序,它作为Windows服务在后台运行。 我已经完成的搜索表明我必须使用Reference Manager的Windows选项卡来定位Windows 8。 但是我的项目中的Reference Manager中没有Windows选项卡,因为它不是Windowsapp store应用程序。 有没有办法从桌面应用程序中使用此API?

在Windows Phone 8.1上获取CivicAddress

我正试图从Windows Phone 8.1中的Geoposition获取CivicAddress 我尝试使用以下代码: // Get Current Location var geolocator = new Geolocator(); geolocator.DesiredAccuracyInMeters = 100; var position = await geolocator.GetGeopositionAsync(); // Get Country var country = position.CivicAddress.Country; 由于CivicAddress字段为null,因此抛出NullReferenceException。 我知道没有为Windows 8提供CivicAddress提供程序。我想检查是否是Windows Phone 8.1的情况。如果是这样,我如何获取/编写CivicAddress提供程序?