geospatial

SQL query to query nearby points of interest based on lat/long - SQLite

假如想象 提交于 2019-12-03 06:01:37
Given a database that contains three fields: Latitude Longitude Proximity Where Lat and Long are GPS coordinates, and Proximity is (some unit - feet? Seconds? Minutes?) And given the user's current GPS lat/long... I want to write a SQL query that will retrieve all rows where the user is within "Proximity" of those rows. And the trick: This has to work in SQLite, which only supports fairly primitive data types. No cheating and relying on SQL Server (or some other product that provides better geospace functions). Any suggestions? Don Jones Here is a C-based custom function for sqlite [copied

Find all coordinates within a circle in geographic data in python

隐身守侯 提交于 2019-12-03 05:54:43
问题 I've got millions of geographic points. For each one of these, I want to find all "neighboring points," i.e., all other points within some radius, say a few hundred meters. There is a naive O(N^2) solution to this problem---simply calculate the distance of all pairs of points. However, because I'm dealing with a proper distance metric (geographic distance), there should be a quicker way to do this. I would like to do this within python. One solution that comes to mind is to use some database

Select all geospatial points inside a bounding box

元气小坏坏 提交于 2019-12-03 05:15:52
问题 I have a table called 'flags' in a MySQL database with 400,000 rows. This table is made up of geospatial points that represent different positions around the UK. The application I'm creating uses Google Maps. On the map is a button that should toggle the flags visibility on the map. It's my job now to create an API that when passed a bounding box all flags inside the bounding box are returned (so that they can then be displayed on the map). The passed parameters are the North East latitude

How is $maxDistance measured in MongoDB?

你说的曾经没有我的故事 提交于 2019-12-03 05:13:54
问题 I can't seem to find this information. But using a geo search you can specify $maxDistance but for the life of me, I can't find if that is miles, kilometers, etc. Here is a sample query I'm using: db.hotels.find( { location: { $near : [18.74255, 99.03523], $maxDistance : 0.05 } } ).count() Returns 15 (from my hotels database). Thanks for any information. 回答1: Unless you're doing a spherical query (like $nearSphere ), MongoDB doesn't actually care about units, it just treats your locations as

Convex hull of (longitude, latitude)-points on the surface of a sphere

强颜欢笑 提交于 2019-12-03 05:00:32
问题 Standard convex hull algorithms will not work with (longitude, latitude)-points, because standard algorithms assume you want the hull of a set of Cartesian points. Latitude-longitude points are not Cartesian, because longitude "wraps around" at the anti-meridian (+/- 180 degrees). I.e., two degrees east of longitude 179 is -179. So if your set of points happens to straddle the anti-meridian, you will compute spurious hulls that stretch all the way around the world incorrectly. Any suggestions

geospatial queries in javascript

柔情痞子 提交于 2019-12-03 04:53:00
问题 I'm looking for a library in javascript that would allow me to make geospatial queries. I know about OpenLayers and GoogleMaps, but this two do not support things like union intersection and so on. +----+ | | | +-+--+ +--+-+ | | | +----+ to +----+ | | | +--+ +--+ | | | +----+ 回答1: Update 2014-04-29: Check out Turf, looks really promising JSTS can do unions of geometric objects in the browser. JSTS integrates with the openlayers library and it extends openlayers geometric classes (e.g.

Hibernate Spatial - Query within an X kilometer radius?

孤人 提交于 2019-12-03 04:31:02
问题 I am new to Hibernate Spatial, and am trying to perform a simple query of objects within a given radius. I've created a number of entries in my database with properties corresponding to a latitude and longitude, using data from Google Maps and other sources. This property is defined like this in my Entity class: @Column @Type(type = "org.hibernate.spatial.GeometryType") private Point coordinates = null; I'm now trying to figure out how to do a search of all entity objects that have

Matching closest longitude/latitude

柔情痞子 提交于 2019-12-03 04:05:48
Using Maxmind's GeoIP software, we can narrow down the LONG/LAT of an IP address to relative accuracy within 25 miles around 80% of the time. Now, we don't want to use any of the other information provided by MaxMind, because there are a lot of discrepancies between feature names, i.e., cities, to perform a look up. We plan on attempting such a look up if other methods fail to locate a feature, but for performance reasons, look ups on floats are much faster than strings. Now, I'm a little clueless on how we can find the closest matching LAT/LONG given from Maxmind to our database. The problem

Distance between 2 POINTs in Postgis in srid 4326 in metres

走远了吗. 提交于 2019-12-03 03:47:11
问题 This is probably a simple question, but I'm not very good at PostGIS and don't fully grok all of this. Basically I have a table ( nodes ) with a POINT column ( point ). I have created an index on this column create index nodes__points on nodes using gist (point) The column was created with select addgeometrycolumn('nodes', 'points', 'POINT', 4326, 2) I am using srid 4326 because I'm adding data that's in the form (latitude, longitude). (i.e. the co-ordinate system where the position of Dublin

How to store geospatial information in mongoDB

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 03:40:03
问题 Acording to the mongoDB documentation (link) if you want to store geospatial information in a document field, you have two options, an array or an embedded document, and the order should be always longitude, latitude. If I want to use an embedded document, how can I ensure the field's order? Or must the fields in the embedded document have a specific name? 回答1: with an embedded document, regardless of the name of the field in the embedded document, the first field should contain the longitude