geo

GEO hash 核心原理

梦想的初衷 提交于 2019-12-12 18:20:08
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 引子 机机是个好动又好学的孩子,平日里就喜欢拿着手机地图点点按按来查询一些好玩的东西。某一天机机到北海公园游玩,肚肚饿了,于是乎打开手机地图,搜索北海公园附近的餐馆,并选了其中一家用餐。 饭饱之后机机开始反思了,地图后台如何根据自己所在位置查询来查询附近餐馆的呢?苦思冥想了半天,机机想出了个方法:计算所在位置P与北京所有餐馆的距离,然后返回距离<=1000米的餐馆。小得意了一会儿,机机发现北京的餐馆何其多啊,这样计算不得了,于是想了,既然知道经纬度了,那它应该知道自己在西城区,那应该计算所在位置P与西城区所有餐馆的距离啊,机机运用了递归的思想,想到了西城区也很多餐馆啊,应该计算所在位置P与所在街道所有餐馆的距离,这样计算量又小了,效率也提升了。 机机的计算思想很朴素,就是通过过滤的方法来减小参与计算的餐馆数目,从某种角度上讲,机机在使用索引技术。 一提到索引,大家脑子里马上浮现出B树索引,因为大量的数据库(如MySQL、oracle、PostgreSQL等)都在使用B树。B树索引本质上是对索引字段进行排序,然后通过类似二分查找的方法进行快速查找,即它要求索引的字段是可排序的,一般而言,可排序的是一维字段,比如时间、年龄、薪水等等。但是对于空间上的一个点(二维,包括经度和纬度),如何排序呢?又如何索引呢

Turn off clipping in a d3 projection

余生颓废 提交于 2019-12-11 19:25:32
问题 I have a projection that does not need clipping. Neither anti-meridian or small circle clipping is there a way to not use either 回答1: Turns out there is this solution. Set the clip angle to 181 degrees. projection(globeProjection.clipAngle(181)) Don't know if this is doing a bunch of calculation and if it is possible to do better 来源: https://stackoverflow.com/questions/30996186/turn-off-clipping-in-a-d3-projection

Geo SQL to find points near location

允我心安 提交于 2019-12-11 10:59:54
问题 I using the below sql: based on http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL SELECT * , 3956 *2 * ASIN( SQRT( POWER( SIN( ( - 36.8812573 - abs( stop_lat ) ) * pi( ) /180 /2 ) , 2 ) + COS( - 36.8812573 * pi( ) /180 ) * COS( abs( stop_lat ) * pi( ) /180 ) * POWER( SIN( ( 174.63832160000004 - stop_lon ) * pi( ) /180 /2 ) , 2 ) ) ) AS distance FROM stops HAVING distance <100 LIMIT 0 , 30 To find stops that are within a radius of my current lat and lon. I am using GTFS data and

GeoJSON Coordinates?

痞子三分冷 提交于 2019-12-11 09:51:23
问题 I have a GeoJSON file that I am trying to process in order to draw some features on top of google maps. The problem, however, is that the coordinates are not in the conventional latitude/longitude representation, but rather some large six/seven figure numbers. Example: { "type": "FeatureCollection", "features": [ { "type": "Feature", "id": 0, "properties": { "OBJECTID": 1, "YR_BUILT": 1950.0 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 772796.724674999713898, 2960766

Spring mongoTemplate. Sort is not working in geo query (NearQuery)

浪尽此生 提交于 2019-12-11 06:19:19
问题 I have a problem with mongoTemplate in Spring when I am trying to query using NearQuery with a Sort. The Sort does not work: Query query = new Query(); query.with(new Sort(Direction.DESC, "timeStamp")); Criteria criteria = new Criteria(); criteria.and("type").is("MeasurementPoint"); query.addCriteria(criteria); NearQuery queryN = NearQuery.near(p).maxDistance(new Distance(distance, Metrics.KILOMETERS)).num(range).query(query); GeoResults<MeasurementPoint> geoPoints = mongoTemplate.geoNear

Android 6.0 getLastKnowLocationPermission

烈酒焚心 提交于 2019-12-11 05:52:28
问题 I have a error when I'm trying to get last known location in Android 6.0 Location lastLocation =locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); Error: java.lang.SecurityException: "network" location provider requires ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission. My manifest: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name=

Check if geolocation is within boundaries

随声附和 提交于 2019-12-11 04:09:48
问题 I'm trying to generate some geolocations within the borders of an area right now I'm trying to generate geo locations within these boundaries $bounds = array( array(55.4024447, 13.1656691), array(56.1575776, 15.8350261), array(68.0410163, 17.4600359), array(58.9380148, 11.3501468), array(67.6820048, 16.1964251) ); and right now my checking for this is as follows if ( ($bounds[0][0] < $lat && $bounds[0][1] < $lng) && ($bounds[1][0] < $lat && $bounds[1][1] > $lng) && ($bounds[2][0] > $lat &&

Interpolation of geodata on surface of a sphere

谁说胖子不能爱 提交于 2019-12-10 16:22:05
问题 I have a dataset with lat/lon coordinates and a corresponding 0/1 value for each geolocation (4 to 200+ datapoints). Now, I want to interpolate the voids and add colors to the surface of the globe based on the interpolation results. The main problem I have is to interpolate "around the globe", because currently I do in a plane, which obviously does not work. My data set.seed(41) n <- 5 s <- rbind(data.frame(lon = rnorm(n, 0, 180), lat = rnorm(n, 90, 180), value = 0), data.frame(lon = rnorm(n,

SQL Server : Geography search performance - query nearest stores

萝らか妹 提交于 2019-12-10 13:53:27
问题 I have a performance query nearest stores: We have a table that contains around 50,000 records (stores/point of sale locations) in one country. Each record has location columns of type "geography" [LOCATION_geo] [geography] Also for performance I created a SPATIAL INDEX over that location column using this syntax CREATE SPATIAL INDEX [LOCATION_geoIndex] ON [dbo].[StoreLocations] ([LOCATION_geo]) USING GEOGRAPHY_GRID WITH ( GRIDS =(LEVEL_1 = MEDIUM,LEVEL_2 = MEDIUM,LEVEL_3 = MEDIUM,LEVEL_4 =

Ensure padding around markers on Google Maps for web [duplicate]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 11:38:01
问题 This question already has answers here : Google Maps API 3 fitBounds padding - ensure markers are not obscured by overlaid controls (7 answers) Closed 3 years ago . I have a full screen Google map with HTML/CSS toolbars overlaid on the map, and a set of map markers. Is there a way to ensure there is enough padding between the markers and the edges of the map, so that no markers are obscured by the toolbars? (Codepen in case the code below doesn't work) function initMap() { var map = new