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
4
votes
1 answer

Optimizing mysql query to select all points with in polygon using spatial indexes

Firstly, I admit that my experience with spatial functions is very minimal. I have a table in MySQL with 20 fields and 23549187 records that contain geographical data. One of the fields is 'point' which is of point data type and has spatial index on…
Rohith Mohan
  • 187
  • 1
  • 14
4
votes
1 answer

Calculate length of route along the predefined line-string from beginning of line-string to points within a buffered region around that line-string

Thus far I have filtered my results to see if they fall within a buffered linestring. Now I would like to calculate the length of the line segment, along the linestring, from the beginning of the route to each latitude and longitude listed in…
Jon
  • 41
  • 2
4
votes
4 answers

Find the smallest area rectangle covering a query point

I'm working on a personal project to do with computational geometry. The question in the title is an abstraction of one of the small subproblems that I am trying, but struggling, to solve efficiently. Hopefully it's general enough to maybe be of use…
Jay
  • 121
  • 1
  • 4
4
votes
2 answers

Optimizing spatial query in R - crown-distributed biomass in forest

I am trying to calculate the area of tree crowns overlapping squared grid cells in a forest plot. Hereafter, a reproducible example: # A. Define objects require(sp) require(raster) require(rgdal) require(rgeos) require(dismo) …
Ervan
  • 174
  • 12
4
votes
2 answers

Oracle Spatial function SDO_CS.Transform(value) results really slow

I have a custom view which queries spatial data from geometry columns and extracts latitude/longtitude values. However, the retrieval process is really slow, and takes upto 5 to 10 mins for the view data to be retrieved. Here is my view: CREATE OR…
reggie
  • 13,313
  • 13
  • 41
  • 57
4
votes
1 answer

Unable to retrieve computed distance in Spatial Solr queries

I'm using this plugin to allow spatial queries in Solr. I have followed the steps included in the documentation and I've got the spatial queries working fine. Now I want to retrieve the computed distance. I added these lines in the solrconfig.xml…
gimenete
  • 2,649
  • 1
  • 20
  • 16
4
votes
5 answers

Select duplicates based on Geometry Column

I have encountered a bit of a tough problem. I need to select all duplicates in a SQL spatial table based on geometry (some has been copy and pasting with out realising they are pasting the same geometry over and over). I need to select all…
4
votes
2 answers

Can I store circle and polygon within the same spatially indexed column in postgis?

According to their documentation the spatial objects can be of the following POINT(0 0) LINESTRING(0 0,1 1,1 2) POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1)) MULTIPOINT(0 0,1 2) MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5…
4
votes
1 answer

Elasticsearch filtering in replacement of PostGIS filtering?

I'd like to totally move on elasticsearch to filter elements currently handled by PostGreSQL with the PostGIS extension. For this, I have to select every result within a given distance around (multi-)polygons. Those polygons may be complex (hundreds…
Léo
  • 469
  • 4
  • 13
4
votes
2 answers

xamGeographicMap shapes from SQL server data

Using the Infragistics xamGeographicMap control, trying to add shapes from SQL server geometry data. The data is valid; a select in SSMS shows the shapes properly Points show properly when querying SP_GEOMETRY (see sample) -- so…
Stu
  • 15,675
  • 4
  • 43
  • 74
4
votes
1 answer

Not able to retrive all points using mysql point type query

I am stuck with problem using spatial data type point in mysql. I have one table called 'tasks' in mysql where I am storing following information. Id Int(11) Primary key Name Varchar(50) Street Varchar(50) City …
Krunal Shah
  • 567
  • 1
  • 10
  • 24
4
votes
1 answer

Mysql select where polygon contains point always false

I have tried various functions like MBRWithin, MBRContains, Intersects, Contains (all of them found in a plenty of posts around here) but no luck yet. This is the simplified query: SELECT * FROM users WHERE Intersects( GeomFromText( 'POINT(50 50)'…
user2074884
4
votes
1 answer

Insert points into SQL Server?

Brand new to python and loving it, and I imagine this might be a simple one. I am currently inserting points into SQL Server 2008 via a Python script with the help of pymssql. var1 = "hi" lat = "55.92" lon = "-3.29" cursor.execute("INSERT INTO…
jakc
  • 1,161
  • 3
  • 15
  • 42
4
votes
10 answers

Possible to calculate closest locations via lat/long in better than O(n) time?

I'm wondering if there is an algorithm for calculating the nearest locations (represented by lat/long) in better than O(n) time. I know I could use the Haversine formula to get the distance from the reference point to each location and sort ASC, but…
mwalsher
  • 2,790
  • 2
  • 33
  • 41
3
votes
2 answers

Data structure to query points which lie inside a triangle

I have some 2D data which contains edges which were rasterized into pixels. I want to implement an efficient data structure which returns all edge pixels which lie in a non-axis-aligned 2D triangle. The image shows a visualization of the problem…
Etan
  • 17,014
  • 17
  • 89
  • 148
1 2
3
27 28