Questions tagged [spatial-query]

a special type of database query on geodata

A spatial query is a special type of database query supported by geodatabases and spatial databases.

Unlike non-spatial SQL queries, these queries use geometry data types such as points, lines and polygons and they consider the spatial relationship between these geometries.

Implementations vary between databases, for instance by adding an extension like for PostgreSQL or using a planar spatial data type like geometry in Microsoft SQL Server.

416 questions
2
votes
1 answer

MongoDB spatial query - error unable to find index or no results

I am having trouble while executing some spatial queries in MongoDb. I have a collection "cities15000" for which every record has this format "_id" : ObjectId("5624aefe4728347a51b1d751"), "geonameid" : "292932", "name" : "Ajman", "asciiname" :…
idimi
  • 23
  • 1
  • 4
2
votes
2 answers

Parametrizing geometry sql command c# in ASP.NET, not working

I have used this string and tested it with string concatenation.But as you know it is not safe to use this to format an sql command. SqlCommand param = new SqlCommand(); param.CommandText = "INSERT INTO Circle (Center_Point, Circle_Data)…
SammyG
  • 299
  • 1
  • 4
  • 15
2
votes
1 answer

Data structure in python for 2d range counting queries

I need a data structure for doing 2d range counting queries (i.e. how many points are in a given rectangle). I think my best bet is range tree (it can count in log^2, or even log after some optimizations). Does it sound like a good choice? Does…
Dani
  • 73
  • 8
2
votes
1 answer

How to query objects within range by longitude/latitude? (ArcGis sde.st_geometry, Oracle)

I have a data table like this: CREATE TABLE devices (id INTEGER PRIMARY KEY NOT NULL, shape SDE.ST_GEOMETRY) For a given GPS location (latitude, longitude), I'd like to query all objects within 50 meters. How to achieve that? I'm so frustrated in…
Verilocos
  • 115
  • 9
2
votes
1 answer

Efficient algorithm for calculating distance between a community (interconnected nodes) to another point

I have a graph structure in a spatial domain (say a dense community like structure) and a query point. I want to devise efficient algorithms + Data Structures to calculate distance between this group as a whole and the query point. A suitable…
Nitish Upreti
  • 6,312
  • 9
  • 50
  • 92
2
votes
1 answer

Spatial Linq query with distance() method

I'm trying to get locations from a SQL Server database which are inside specific radius. It works fine when I use spatial data from database and pass it to the DBGeography.Distance() method. But when i try to pass coordinates to Distance() method…
2
votes
1 answer

Where Can I Find the Source Code of Spatial Relationships Functions?

Where can I find the source codes of spatial relationships functions such as ST_Overlaps?
2
votes
1 answer

st_intersect() not working in postgresql

i am using postgresql version : "PostgreSQL 9.3.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2), 64-bit" i have created 2 tables A and B with point and polygon as a data type. now i want to know whether point…
2
votes
1 answer

Why Is My Spatial Hash So Slow?

Why is my spatial hash so slow? I am working on a code that uses smooth particle hydrodynamics to model the movement of landslides. In smooth particle hydrodynamics each particle influences the particles that are within a distance of 3 "smoothing…
user3100953
  • 23
  • 1
  • 3
2
votes
1 answer

Perform a subquery on a spatial table in MySQL

I have a spatial table of polygons. I am trying to find what polygon a lat/lng point lies within in a MySQL spatial table efficiently. I know ST_Within is available for MySQL 5.6 however my version pre-dates this so I am combining two functions I…
Gga
  • 4,311
  • 14
  • 39
  • 74
2
votes
1 answer

Apache Solr - Lucene - Zip Code Radius Search

I have an existing collection of PERSON's records already loaded to my Solr Server. Each record has a field for a ZIPCODE. I know that Solr now supports spatial search with the geodist() function, the problem is that I do not have the lat and long…
A.O.
  • 3,733
  • 6
  • 30
  • 49
2
votes
1 answer

get the values in a given radius from numpy array

I want to recover a "buffer" around a given value in a 2-D numpy array in python. The idea is to select all the values comprised within a given radius and then mask them. It would be something like: select a "cell" in the matrix, like matrix[x,…
Guadancil11
  • 625
  • 3
  • 8
  • 16
2
votes
1 answer

SQL Server 2012 Spatial Index Nearest Neighbor query

I have created a table containing US zipcodes along with the latitude and longitude of these zip codes. From the latitude and longitude I created a geography column. I created a spatial index on that geography column. I want to return the closest…
DaveF
  • 67
  • 1
  • 6
2
votes
2 answers

points within a particular distance

I have a table conatining a set of points. I would like to make a query that checks the distance between the points and if the distance is small er than the tolerance it would set the points to just one. Any suggestions how I can accomplish such…
IT_info
  • 707
  • 4
  • 16
  • 36
2
votes
1 answer

spatial data query

I have the following query which does a self join with a table and outputs all the points of intersections between lines. insert into road_intersection select nextval('road_intersection_id_seq'), a.road_id, b.road_id, st_intersection(a.road,…
IT_info
  • 707
  • 4
  • 16
  • 36