geospatial

how to use geoNear in nodejs?

北城余情 提交于 2020-01-01 14:08:21
问题 I want to use geospatial geoNear, database in mongodb, Mongo Query: db.runCommand( { geoNear: "tmp", near: { type: "Point", coordinates: [ 77.00000, 12.00000] }, spherical: true, maxDistance : 200 } ) Gives result in mongo terminal, but how to execute it using node.js I am using mongo-pool and generic-pool for mongo pooling? 回答1: Use the $geoNear operator for the aggregation pipeline (available if you are using MongoDB 2.4 or greater). For example: var mongodb = require('mongodb') ,

How to Calculate Centroid

雨燕双飞 提交于 2020-01-01 10:10:12
问题 I am working with geospatial shapes and looking at the centroid algorithm here, http://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon I have implemented the code in C# like this (which is just this adapted), Finding the centroid of a polygon? class Program { static void Main(string[] args) { List<Point> vertices = new List<Point>(); vertices.Add(new Point() { X = 1, Y = 1 }); vertices.Add(new Point() { X = 1, Y = 10 }); vertices.Add(new Point() { X = 2, Y = 10 }); vertices.Add(new Point()

How can I sort a coordinate list for a rectangle counterclockwise?

☆樱花仙子☆ 提交于 2020-01-01 09:41:56
问题 I need to sort a coordinate list for a rectangle counterclockwise, and make the north-east corner the first coordinate. These are geographic coordinates (i.e. Longitude, Latitude) in decimal form. 1 For example, here are the 4 corners of a rectangle, starting with the north-west corner and moving clockwise: [ { "lat": 34.495239, "lng": -118.127747 }, # north-west { "lat": 34.495239, "lng": -117.147217 }, # north-east { "lat": 34.095174, "lng": -117.147217 }, # south-east { "lat": 34.095174,

Converting lat/long to JTS?

吃可爱长大的小学妹 提交于 2020-01-01 07:59:34
问题 I am trying to integrate hibernate spatial with JPA for Geo searches. I have been referencing the tutorial on the official site (I am not associated with hibernatespatial). The tutorial, unfortunately, does not cover how to create a Point instance from a latitude/longitude pair. I'm attempting to do this here, but I am still not sure if this is this the right way to convert a latitude/longitude pair to a JTS Point instance: import com.vividsolutions.jts.geom.Coordinate; import com

Get ECEF XYZ given starting coordinates, range, azimuth, and elevation

冷暖自知 提交于 2020-01-01 06:33:05
问题 I'm having a problem locating anything on converting RAE to XYZ. If I am on a WGS84 spheroid, at say position -742507, -5462738, 3196706 and I detect an object at a range of 30km, azimuth of 310, and elevation angle of 18 degrees how can I convert that to ECEF XYZ coordinates? Thanks. 回答1: It appears that there is no straight forward process to do this. The best method I found is to convert from RAE coordinates to SEZ coordinates, then from SEZ coordinates to ECR coordinates. Here is some C#

Spatial index/query (finding k nearest points)

时光总嘲笑我的痴心妄想 提交于 2020-01-01 03:57:05
问题 I have +10k points (latitude, longitude) and I'm building an app that shows you the k nearest points to a user's location. I think this is a very common problem and I don't want to reinvent the wheel. I'm learning about Quadtrees. It seems to be a good approach to solve this spatial problem. I'm using these tools: Python 2.5 MySQL MongoDb Building the Quadtree is not that hard: http://donar.umiacs.umd.edu/quadtree/points/pointquad.html But once I've created the tree and saved it to a db

How can I extend this SQL query to find the k nearest neighbors?

依然范特西╮ 提交于 2020-01-01 02:42:11
问题 I have a database full of two-dimensional data - points on a map. Each record has a field of the geometry type. What I need to be able to do is pass a point to a stored procedure which returns the k nearest points (k would also be passed to the sproc, but that's easy). I've found a query at http://blogs.msdn.com/isaac/archive/2008/10/23/nearest-neighbors.aspx which gets the single nearest neighbour, but I can't figure how to extend it to find the k nearest neighbours. This is the current

MySQL: Spatial Query to find whether a latitude/longitude point is located within a given boundary

六眼飞鱼酱① 提交于 2020-01-01 00:41:29
问题 I'm working on google map search functionality. The vision of this is to find whether a (geolocation) point is located within a polygon or not as shown in the illustration below? I'm using mysql 5.6.20 with Spatial extension, I know it has useful geometry functions built-in, so I will be allowed to query geocoded locations from a database directly. My aim was to familiarize myself with geospatial functions, so I wrote up an experimental sql. given a point geolocation: POINT(100.52438735961914

What would a minimal example for a choropleth map in Mathematica look like?

旧巷老猫 提交于 2019-12-31 22:41:33
问题 What would a minimal example for a choropleth map in Mathematica look like? I can read in a ESRI Shapefile using Import , but do not know how to work with the imported result. 回答1: Graphics[ { ColorData["ThermometerColors"][ Rescale[CountryData[#, "GDPPerCapita"], {100, 50000}] ] /. HoldPattern[Blend[___]] -> Yellow, CountryData[#, "Polygon"] } & /@ CountryData[] ] And why the replacement? If there are no data of the required type for a given country CountryData returns Missing["NotAvailable"

What would a minimal example for a choropleth map in Mathematica look like?

非 Y 不嫁゛ 提交于 2019-12-31 22:41:28
问题 What would a minimal example for a choropleth map in Mathematica look like? I can read in a ESRI Shapefile using Import , but do not know how to work with the imported result. 回答1: Graphics[ { ColorData["ThermometerColors"][ Rescale[CountryData[#, "GDPPerCapita"], {100, 50000}] ] /. HoldPattern[Blend[___]] -> Yellow, CountryData[#, "Polygon"] } & /@ CountryData[] ] And why the replacement? If there are no data of the required type for a given country CountryData returns Missing["NotAvailable"