geo

MongoDB How to find which polygon contains a specified Point?

一曲冷凌霜 提交于 2019-12-10 06:14:58
问题 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

What's the best way to lookup the US county a US city resides in?

自作多情 提交于 2019-12-10 02:09:34
问题 I'm looking for the best/easiest way to programmatically grab the name of the US county a given US city resides in. It doesn't seem there's a straightforward API available for such a (seemingly simple) task? 回答1: You can download a freely-available database of county/city/zip code info such as this one: http://www.unitedstateszipcodes.org/zip-code-database/ (no need to register or pay) Import it whole, or a subsection of it, into a local, persistent data store (such as a database) and query

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

独自空忆成欢 提交于 2019-12-10 00:12:57
问题 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..

how to get the nearest 100 points from one million data records quickly?

末鹿安然 提交于 2019-12-09 03:38:42
问题 given one point A, get the nearest 100 points from one million data records database is MySql one million records of latitude and longitude these points mean user's current position when logined , so they may be changing. scenario: when a user open a page , display the nearest top 100 other people. 回答1: Setup spatial extensions for your database, if you have not done that already. Store latitude/longitude of your 1M locations in a geography-type column in the database. Create a spatial index

How to get the intersecting points from shape in ElasticSearch

喜夏-厌秋 提交于 2019-12-08 19:06:50
问题 I have stored a route in ElasticSearch as a Polygon. Now I have a circle (A point and a radius), I'am able to check the circle points intersects the polygon or not (Below is the code I used). Question: How can I get the points in the route which intersects the circle ? public Boolean isMatchingDoc(Long elasticDocId, Double latitude, Double longitude, Long radius) { Coordinate origin = new Coordinate(latitude, longitude); ShapeBuilder circleShapeBuilder = ShapeBuilder.newCircleBuilder().center

Accessing nested property in Elasticsearch distance script.

别来无恙 提交于 2019-12-08 12:54:29
问题 My index in elastic search has the following mapping: "couchbaseDocument": { "properties": { "doc": { "properties": { "properties": { "properties": { "location": { "type": "geo_point" The source document is as follows: {"properties" : {"location":"43.706596,-79.4030464"}} I am trying to use the distance script to calculate the distance based on geo-points. I found this post Return distance in elasticsearch results? to help me out. I am trying to get all results,filter by radius 1km, get the

Visualizing data on geographic map with networks (R)

被刻印的时光 ゝ 提交于 2019-12-08 12:28:46
问题 I am trying to depict a network on the geographic map using data contained in a cultural distance matrix. E.g.: AT BE CH CZ AT 0 0.00276 0.148 0.109 BE 0.00276 0 0.145 0.112 CH 0.148 0.145 0 0.257 CZ 0.109 0.112 0.257 0 Starting and ending points of the network’s lines should be located in different countries (i.e. here AT, BE, CH and CZ). Lines should be depicted between countries when a corresponding entry of the matrix is below a certain threshold (e.g., the mean of all matrix’ entries).

Get X,Y from LAT,LNG custom svg map

泪湿孤枕 提交于 2019-12-08 09:58:30
问题 Hi to all i'm developing a map with raphael.js as they do in here : http://raphaeljs.com/world/ the problem is that i'm using a custom svg world map so they function getXY() obviously wont return the correct x,y of a lat,lng. How can i calculate the x and y of a given lat/lng knowing the map width/height and the rapport froma point and his coordinates (x:1104.73=lng:42.998604)(y:559.25=lat:9.424553). they use this code: cx: lon * 2.6938 + 465.4 y: lat * -2.6938 + 227.066 but i cant figure out

MySQL GeoSpatial function for ST_Distance_Spheroid? Metric used in return Type of GLength?

醉酒当歌 提交于 2019-12-08 06:55:28
Is there a ST_Distance_Sphere, ST_Distance_Spheroid equivalent function in MySQL's GeoSpatial Support? If not, any way to emulate this? What is the metric used in return type of GLength (length of the LineString)? The manual for GLength says that GLength() is a nonstandard name. It corresponds to the OpenGIS Length() function. But I couldn't find any Docs for OpenGIS Length(). All I found was for ST_Length are they the same? Also for accuracy do I need to specify the SRID(4326)? How Do I do this in MySQL? Since MySql 5.1 there are provided GIS functions distance_sphere() and distance_spheroid(

How can I make a custom SVG overlay on Leaflet without using D3?

╄→尐↘猪︶ㄣ 提交于 2019-12-08 03:40:00
问题 I have recently started a small project that involves drawing transport scheme on top of the Leaflet map. I've got a collection (array) of points denoting stops, each having an attribute location (LatLng). How can I place them on the map without using native markers but using SVG layer with paths & circles instead and guaranteeing the correct geographical placement of elements on every dragging or zooming of the map? So far, I've thought of: Using the SVG overlay provided by Leaflet inside