geo

MongoDB How to find which polygon contains a specified Point?

我是研究僧i 提交于 2019-12-05 13:08:37
I insert many polygons into MongoDB(2.4.8), and hope find the polygon a specified Point sits in. It seems a common question. But after reading all docs from google, I didn't get the result. So create this question. e.g. db.addr_poly.insert( { loc : { type : "Polygon" , coordinates : [ [ [ 0 , 0 ] , [ 3 , 6 ] , [ 6 , 1 ] , [ 0 , 0 ] ] ] } }) db.addr_poly.insert( { loc : { type : "Polygon" , coordinates : [ [ [ 0 , 0 ] , [ -3 , -6 ] , [ -6 , -1 ] , [ 0 , 0 ] ] ] } }) Now how to find the polygon which contains Point(1,1)? Anybody can help me? Thanks a lot! Use the $geoIntersects operator . It

Redis GEO 地理位置

孤街浪徒 提交于 2019-12-05 10:13:28
目录 GEO指令 GEOADD GEODIST GEOPOP GEOHASH GEORADIUS GEORADIUSBYMEMBER 指令补充 删除操作 避免单集合数量过多 存储原理 GEOADD存储原理 GEOHASH精度问题 Redis 3.2版本新增GEO(地理位置)。 GEO指令 GEOADD 命令: GEOADD key longitude latitude member [longitude latitude member ...] 命令描述:将指定的地理空间位置(纬度、经度、名称)添加到指定的 key 中。 返回值:添加到sorted set元素的数目,但不包括已更新score的元素。 时间复杂度:O(log(N)) GEODIST 命令: GEODIST key member1 member2 [unit] 命令描述: 返回两个给定位置之间的距离。如果两个位置之间的其中一个不存在, 那么命令返回空值。指定单位的参数 unit 必须是以下单位的其中一个: m 米 km 千米 mi 英里 ft 英尺 时间复杂度:O(log(N)) GEOPOP 命令: GEOPOS key member [member ...] 命令描述:从key里返回所有给定位置元素的位置(经度和纬度)。 返回值:GEOPOS 命令返回一个数组, 数组中的每个项都由两个元素组成:

Maximum length of a decimal latitude/longitude Degree?

南笙酒味 提交于 2019-12-05 08:27:27
What is the maximum length (in kilometers or miles - but please specify) that one degree of latitude and longitude can have in the Earth surface? I'm not sure if I'm being clear enough, let me rephrase that. The Earth is not a perfect circle, as we all know, and a change of 1.0 in the latitude / longitude on the equator (or in Ecuador) can mean one distance while the same change at the poles can mean another completely different distance. I'm trying to shrink down the number of results returned by the database (in this case MySQL) so that I can calculate the distances between several points

Accessing Leaflet.js GeoJson features from outside

一曲冷凌霜 提交于 2019-12-05 01:38:10
问题 I want to interact with a leaflet powered map's GeoJson overlay (polygons) from outside of L. 's realm, but I don't seem to be able to access objects created by L. . Interaction would include: getBounds(myFeature) fitBounds(myFeature) setStyle etc I can see Leaflet exposing L.GeoJSON.getFeature(), but I don't seem to be able to squeeze anything out of it. No documentation, and the inspector seems to suggest it does not take arguments... :\ Is this just there for future development? 回答1: You

Show current location of user on an offline static image (jpeg) - Android

南笙酒味 提交于 2019-12-04 21:51:48
Background / Concept: I want to create an application that can help user searching for specific things. Let say nearby restaurants. Here I want to include an offline map covering 1 km area around that restaurant, (its easy i can take snap of google map). Problem: is it possible to indicate current user position on that static image file? I have some idea that I note the Lat / Long of all four corners of that image, take user current position, do some calculation and show the current spot.. But I m not sure where to start and if there is already a good optimized solution. If I can show current

Get latitude and longitude points along a line between two points, by percentage

馋奶兔 提交于 2019-12-04 19:29:23
In the image below, you can see that there 3 lines drawn from one point (the black circle) to its 3 related points (). IMAGE QUESTION How to calculate latitude and longitude point between points along each line, using a percentage of the distance between the two points? For example, if I wanted to get the position to be able to draw additional circles along each line with a 20% difference? WHAT CODE I HAVE NOW var data = [ { "coords" : [ 53.409045, -2.985406 ]}, { "coords" : [ 53.408747, -2.982862 ]}, { "coords" : [ 53.407630, -2.984136 ]}, { "coords" : [ 53.407142, -2.986931 ]} ]; var pointA

Geo distance calculation using SparkR

做~自己de王妃 提交于 2019-12-04 19:17:07
I have a Spark dataframe in R as follows head(df) Lat1 Lng1 Lat2 Lng2 23.123 24.234 25.345 26.456 ... ... ... ... The DataFrame contains two points Latitude and Longitude I would like to calculate the Geo distance between the nodes in each row and add it to a new column. In R I am using distCosine function from geosphere library. df$dist = distCosine(cbind(df$lng1,df$lat1),cbind(df$lng2,df$lat2)) I am wondering how I should calculate it in SparkR. SparkR produces the following error, Error in as.integer(length(x) > 0L) : cannot coerce type 'S4' to vector of type 'integer' You cannot use

How can I quickly determine the State for a given zipcode?

三世轮回 提交于 2019-12-04 13:49:25
问题 I don't need the city or address, just the state. And I don't want to make an API call if possible. The priority is a light-weight solution, ideally just Javascript. I have a user-input zipcode , and I want to display a paragraph of text depending on the state that the zipcode is in. I know it's much more complicated to lookup City and State, and for that an API such as the one the USPS exposes is probably best. But to just match state, perhaps on just the first three numbers, the solution (I

陆地与波浪演示程序(第七章内容)

旧城冷巷雨未停 提交于 2019-12-04 11:58:14
7.7、陆地与波浪演示程序 在本小节中,我们将展示如何构建“陆地与波浪”演示程序: 构建一个三角形栅格(grid),并通过将其中的顶点设置到不同的位置来创建 地形 再构建一个三角形栅格(grid),通过动态的改变其顶点高度来创建 波浪 此示例还会 针对不同的常量缓冲区来切换所使用的根描述符 ,这可以让我们不需要设置CBV描述符堆 7.7.1、生成栅格顶点 为了生成地形和波浪,我们首先要构建三角形栅格(grid),这里我们不进行详细的数学分析,直接给出结论: \[ 在xz平面上,第i行、第j列栅格顶点的坐标可以表示为:v = [-0.5w + j*dx, 0.0f, 0.5d - i*dz] \] 其中w为栅格的总宽度(宽),dx为每一个小四边形的宽度,d为栅格的总深度(长),dz为每一个小四边形的深度, (其实可以把栅格理解成一个由许多小四边形组成的大四边形) 下面是生成栅格顶点的代码: /* ** Summary:生成栅格顶点 ** Parameters: ** width:栅格的宽度 ** depth:栅格的深度 ** m:行数 ** n:列数 ** Return:栅格的网格数据 */ GeometryGenerator::MeshData GeometryGenerator::CreateGrid(float width, float depth, uint32 m,

Geo chart for java

只愿长相守 提交于 2019-12-04 11:41:28
问题 Can anyone recommend a Java component that lets you create a pretty looking image of a world map, highlighting certain countries (based on some statistics). Something similar to this image: Something similar to Google Geo Charts (but for Java): https://developers.google.com/chart/interactive/docs/gallery/geochart but runs on the server side, without an internet connection. Ideally I'd like to attach weight to a few countries which would highlight them proportionally. Either open source or