geospatial

MongoDB Geospacial Query Spheres Overlapping Single Point

烂漫一生 提交于 2019-12-04 12:08:43
问题 I am trying to create a geospacial query in MongoDB that finds all circles (with varying radius) that overlap a single point. My data looks something like this: { name: "Pizza Hut", lat: <latitude> lon: <longitude> radius: 20 ... } Basically, I am trying to do exactly what is described in this SO post but with MongoDB - Get all points(circles with radius), that overlap given point geoIntersects (http://docs.mongodb.org/manual/reference/operator/query/geoIntersects/) looks like what I need.

spatial clustering in R (simple example)

青春壹個敷衍的年華 提交于 2019-12-04 12:02:54
问题 I have this simple data.frame lat<-c(1,2,3,10,11,12,20,21,22,23) lon<-c(5,6,7,30,31,32,50,51,52,53) data=data.frame(lat,lon) The idea is to find the spatial clusters based on the distance First, I plot the map (lon,lat) : plot(data$lon,data$lat) so clearly I have three clusters based in the distance between the position of points. For this aim, I've tried this code in R : d= as.matrix(dist(cbind(data$lon,data$lat))) #Creat distance matrix d=ifelse(d<5,d,0) #keep only distance < 5 d=as.dist(d)

Updating SQL Server 2008 records w/spatial data types via Massive ORM (ExecuteNonQuery), UdtTypeName error

荒凉一梦 提交于 2019-12-04 11:57:36
I'm trying to use Massive "dynamic ORM" by Rob Conery to query my DB (working GREAT so far). Ran into a problem when I added a Geography field to my tables. Here's the error: UdtTypeName property must be set for UDT parameters Update (14Apr2011): The ADO method that is throwing the exception is .ExecuteNonQuery(); Here's the method from Massive.cs that throws the exception: public virtual int Execute(IEnumerable<DbCommand> commands) { var result = 0; using (var conn = OpenConnection()) { using (var tx = conn.BeginTransaction()) { foreach (var cmd in commands) { cmd.Connection = conn; cmd

Find N Nearest LineString From A Point Using MySQL Spatial Extensions

随声附和 提交于 2019-12-04 11:16:15
问题 I'm using MySQL Spatial Extensions to store data about roads and hotels. I store the hotel data as a Point while I store the road data as LineString. The tables look like this CREATE TABLE IF NOT EXISTS `Hotels` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `name` text, `coordinate` point NOT NULL, PRIMARY KEY (`id`), SPATIAL KEY `coordinate` (`coordinate`), ) CREATE TABLE IF NOT EXISTS `Roads` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `name` text, `route` linestring NOT NULL, PRIMARY KEY (

Finding latitude and longitude of many places once

陌路散爱 提交于 2019-12-04 10:56:41
I have a long list of towns and cities, and I'd like to add latitude and longitude information to each of them. Does anyone know the easiest way to generate this information once? See also Geocode multiple addresses The first part of the third video shows how to get latitude and Longitude using Google Refine and geocoding. No need to write a new script. Ideal for doing this kind of change once . http://code.google.com/p/google-refine/ Or use www.geonames.org - there's language APIs for that. Or Open Street Map's Nominatim: http://wiki.openstreetmap.org/wiki/Nominatim - google have slightly

R - Fitting a grid over a City Map and inputting data into grid squares

女生的网名这么多〃 提交于 2019-12-04 10:21:38
I'm trying to place a grid over San Jose like this: Grid of San Jose You can make the grid visually using the following code: ca_cities = tigris::places(state = "CA") #using tigris package to get shape file of all CA cities sj = ca_cities[ca_cities$NAME == "San Jose",] #specifying to San Jose UTM_ZONE = "10" #the UTM zone for San Jose, will be used to convert the proj4string of sj into UTM main_sj = sj@polygons[[1]]@Polygons[[5]] #the portion of the shape file I focus on. This is the boundary of san jose #converting the main_sj polygon into a spatialpolygondataframe using the sp package tst_ps

how to use geoNear in nodejs?

邮差的信 提交于 2019-12-04 10:08:40
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? Use the $geoNear operator for the aggregation pipeline (available if you are using MongoDB 2.4 or greater). For example: var mongodb = require('mongodb') , MongoClient = mongodb.MongoClient , express = require('express') , app = express(); var db; MongoClient.connect

How best to perform corridor range search over a set of latitude / longitude coordinates

纵然是瞬间 提交于 2019-12-04 10:02:45
What would be the best approach to finding the set of coordinates, from say about 5,00, which lie within a path of points, given a specified width. eg an aircraft following several waypoints. Is there a good way to also sort them in the same order as the route. Calculation speed would be more important than accuracy, since I'm looking at producing a list of suggestions. From what I've looked at, I presume it's not straightforward, and the question is a bit broad, but any suggestions/pointers would be welcome, eg for: Best way to store lat / long, or use spherical coordinates Having additional

MongoDB geospatial index in C#

自闭症网瘾萝莉.ら 提交于 2019-12-04 09:51:24
I have been trying to get started but run into the same rock time after time trying to create and query MongoDB with C# official driver. The problem is how to create data with geo information. I am just not finding the answer. Code: MongoUrl url = new MongoUrl("mongodb://xxx.xx.x.xx/mydb"); MongoServer server = MongoServer.Create(url); MongoDatabase database = server.GetDatabase("mydb"); <-- this works fine BsonDocument[] batch = { new BsonDocument { { "name", "Bran" }, { "loc", "10, 10" } }, new BsonDocument { { "name", "Ayla" }, { "loc", "0, 0" } } }; places.InsertBatch(batch); <-- that part

Error when using Spatial Index in SQL Server

那年仲夏 提交于 2019-12-04 09:14:56
I use Spatial Index and when I try to execute WHERE statement: WHERE T.GEOMETRY.STIntersects(O.GEOMETRY) = 1 AND T.GEOMETRY.STTouches(O.GEOMETRY) = 0 It works fine, but when I try to execute with OR: WHERE T.GEOMETRY.STOverlaps(O.GEOMETRY) = 1 OR T.GEOMETRY.STWithin(O.GEOMETRY) = 1 I get this error: The query processor could not produce a query plan for a query with a spatial index hint. Reason: Could not find required binary spatial method in a condition. Try removing the index hints or removing SET FORCEPLAN. Any help, what is a problem in this statement? A general solution for issues with