geo

How can i calculate the distance between two gps points in Java?

浪尽此生 提交于 2019-11-30 01:40:41
I used this code but it doesnt work: Need the distance between two gps coordinates like 41.1212, 11.2323 in kilometers (Java) double d2r = (180 / Math.PI); double distance = 0; try{ double dlong = (endpoint.getLon() - startpoint.getLon()) * d2r; double dlat = (endpoint.getLat() - startpoint.getLat()) * d2r; double a = Math.pow(Math.sin(dlat / 2.0), 2) + Math.cos(startpoint.getLat() * d2r) * Math.cos(endpoint.getLat() * d2r) * Math.pow(Math.sin(dlong / 2.0), 2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); double d = 6367 * c; return d; } catch(Exception e){ e.printStackTrace(); }

How can I use SVG translate to center a d3.js projection to given latitude and longitude values?

六月ゝ 毕业季﹏ 提交于 2019-11-29 23:56:02
问题 I am using d3 to render a Mercator projection of a GeoJSON world map. I would like to be able to use d3 to scale, and translate the map to known latitude and longitude values as the user steps through my application. projection.center (https://github.com/mbostock/d3/wiki/Geo-Projections#wiki-center) does what I'd like, combined with transition().duration() , but this requires redrawing the map and therefore seems expensive to keep repeating. I would like to use the native translate() and

Convert meters to decimal degrees

此生再无相见时 提交于 2019-11-29 18:45:31
问题 I need to convert meters to decimal degrees in C#. I read on Wikipedia that 1 decimal degree equals 111.32 km. But it is on equator, so if I'm located above/below it my the conversion will be wrong? I assume this is wrong: long sRad = (long.Parse(sRadTBx.Text)) / (111.32*1000); EDIT: I need this search radius to find nearby users long myLatitude = 100; long myLongitude = 100; long sRad = /* right formula to convert meters to decimal degrees*/ long begLat = myLatitude - searchRad; long endLat

KML opens with the wrong geoposition

此生再无相见时 提交于 2019-11-29 17:50:15
I'm trying to create a map of the Stockholm's subway lines in Fusional Tables. In the Fusion Tables I created a map with geo each station: https://www.google.com/fusiontables/DataSource?docid=1K7F2DMY5JBA6ZQOH8a1a4dQjwxoksRDMJ3-wPEg#map:id=3 I want to connect them to the polyline. Options to create polylines and way in the tables there, or they are very well hidden. So I created this KML file and loaded into tables: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> <name>Stockholms T-bana</name> <description>Karta över röda linjen i Stockholms T

Elasticsearch(GEO)数据写入和空间检索

主宰稳场 提交于 2019-11-29 17:08:40
Elasticsearch简介 什么是 Elasticsearch? Elasticsearch 是一个开源的分布式 RESTful搜索和分析引擎,能够解决越来越多不同的应用场景。 本文内容 本文主要是介绍了ES GEO数据写入和空间检索,ES版本为7.3.1 数据准备 Qgis使用渔网工具,对范围进行切割,得到网格的Geojson 新建索引设置映射 def set_mapping(es,index_name="content_engine",doc_type_name="en",my_mapping={}): # ignore 404 and 400 es.indices.delete(index=index_name, ignore=[400, 404]) print("delete_index") # ignore 400 cause by IndexAlreadyExistsException when creating an index my_mapping = { "properties": { "location": {"type": "geo_shape"}, "id": {"type": "long"} } } create_index = es.indices.create(index=index_name) mapping_index = es.indices

Using WHERE clause to find POI within a range of distance from Longitude and Latitude

点点圈 提交于 2019-11-29 14:14:19
I'm using following sql code to find out 'ALL' poi closest to the set coordinates, but I would want to find out specific poi instead of all of them. When I try to use the where clause I get an error and it doesn't work and this is where I'm currently stuck, since I only use one table for all the coordinates off all poi's. SET @orig_lat=55.4058; SET @orig_lon=13.7907; SET @dist=10; SELECT *, 3956 * 2 * ASIN(SQRT(POWER(SIN((@orig_lat -abs(latitude)) * pi()/180 / 2), 2) + COS(@orig_lat * pi()/180 ) * COS(abs(latitude) * pi()/180) * POWER(SIN((@orig_lon - longitude) * pi()/180 / 2), 2) )) as

redis GEO的使用

时光毁灭记忆、已成空白 提交于 2019-11-29 09:51:22
一、概念 redis的GEO特性在Redis3.2版本发布,这个功能可以将用户给定的地理位置信息储存起来,并对这些信息进行操作。 GEO常用语LBS(Location Based Service),基于位置的服务。 二、GEO相关命令 命令名称: geoadd 语法:geoadd key longitude latitude member [longitude latitude member……] 功能: 将给定的空间元素(维度、经度、名字)添加到指定的键里面。 有效的经度介于-180度至180度之间。 有效的维度介于-85.05112878度至85.05112878度之间。 返回值: 新添加到键里面的空间元素数量,不包括那些已经存在但是被更新的元素。 命令名称: geopos 语法:geopos key member [member……] 功能: 从键里面返回所有给定位置元素的位置(经度和维度) 返回值: 返回一个数组,数组中的每个项都由两个元素组成:第一个元素为给定位置元素的经度,第二个元素为给定位置元素的纬度。 命令名称: geodist 语法:geodist key member1 member2 [unit] 功能: 返回两个给定位置之间的距离。 如果两个位置之间的其中一个不存在,那么返回空值。 指定单位的参数unit必须是一下单位的其中一个:(默认m,km,mi,ft)

Google Geolocation API library

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 04:34:38
Is there a library out there that will get you your approximate location using the google service ( https://www.google.com/loc/json )? Google Gears has support for it as described here http://code.google.com/p/gears/wiki/GeolocationAPI There is also good doco on the web service request/response schema. Firefox and iPhone Safari use the service as well and they have their own implementations. I would like to use the service in my own C# application so I would like a library that I can use (either one of C/C++/C#). Currently the only way my colleague got it working is using a gears plugin for IE

Android intent for opening both Waze and Google maps

夙愿已清 提交于 2019-11-29 02:26:00
问题 There are a few similar posts but I couldn't find an exact one. basically, I want to open both Google maps and Waze with the same intent. At first I tried this: final String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude); final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(intent); Waze navigated directly to the right location and Google maps opened the right place. then I realized that Google maps doesn't put a pin on the location so it

How can i calculate the distance between two gps points in Java?

我怕爱的太早我们不能终老 提交于 2019-11-28 22:29:09
问题 I used this code but it doesnt work: Need the distance between two gps coordinates like 41.1212, 11.2323 in kilometers (Java) double d2r = (180 / Math.PI); double distance = 0; try{ double dlong = (endpoint.getLon() - startpoint.getLon()) * d2r; double dlat = (endpoint.getLat() - startpoint.getLat()) * d2r; double a = Math.pow(Math.sin(dlat / 2.0), 2) + Math.cos(startpoint.getLat() * d2r) * Math.cos(endpoint.getLat() * d2r) * Math.pow(Math.sin(dlong / 2.0), 2); double c = 2 * Math.atan2(Math