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

Identifying the unique values that form part of a SQL sum query

I have 2 queries that I would like to make work together: 1) one query sums the number of geometry points within a certain distance of another and returns results only where the count is greater 6 points; 2) one query returns the unique ID for all…
0
votes
1 answer

What is the better table layout for polygons inside polygons

I'm pretty new to spatial stuff so forgive the beginner question. If I expect to have many polygons that look like the picture, is it best to have 1 table with a column defined like POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),(20 30, 35 35, 30…
Geoffrey Ochsner
  • 235
  • 3
  • 14
0
votes
2 answers

How to count number of points in certain distance from center point using postgis?

I'm looking for a solution of following problem: I have table of thousands of point features in postgress 9.3. I would like to get rid of insignificant points. By insignificant I understand points with not many neighbors, what could be defined…
user30455
  • 9
  • 3
0
votes
1 answer

Neo4j / Cypher Query using withinDistance returns 0 rows

I've just set the Neo4j Spatial plugin on my server and I'm using SDN 3.1.2 to create my wkt index: @Indexed(indexName = "CarsLocation", indexType = IndexType.POINT) var wkt: String The whole works great and I can make queries involving…
Mik378
  • 21,881
  • 15
  • 82
  • 180
0
votes
0 answers

mysql spatial data storage

I am trying to insert simple geometry data in mysql database but I am getting some weird symbols instead of numbers in the rows. Does anyone know why? This is the query that I am running: SET @g = 'LINESTRING(0 0,1 1,2 2)'; INSERT INTO geom (g)…
Moki
  • 199
  • 1
  • 4
  • 15
0
votes
2 answers

Need expert's help to solve minor change in spatial data query

i have the following query to access the nearest locations around the given lat-lon. I followed Mr.Ollie's blog Nearest-location finder for MySQL to find nearest locations around given lat-long using haversine formula. But due to lack of much…
Aparichith
  • 1,452
  • 4
  • 20
  • 40
0
votes
0 answers

Erasing Polygon Overlay in Spatial Analysis

I am using Sutherland Hodgman's Algorithm inorder to clip the polygon overlay for clipping Spatial Query. And I want to implement erase overlay function as well. So suggest me some algorithm like Sutherland Hodgman Algorithm or Can anyone modify…
Venkatesh
  • 1,537
  • 15
  • 28
0
votes
1 answer

DbSpatialServices.Default.Within method for DbGeography

In EF 6 I can use DbSpatialServices.Default.Within but with DbGeometry types only as parameters, how can I use the Within function with DbGeography type? SQL Server 2012 has a new spatial function STWithin which accepts DbGeography and…
Socardo
  • 520
  • 6
  • 14
0
votes
1 answer

Intersect Point on line buffered with MSSQL Spatial

I am trying to assign an id to a set of that that is within a line buffered (0.000054) ,I notice that at the end of a buffered line, it's round in shape. attached is my data sample where i have yellow indicating the original line.. and the yellow…
SiGaban
  • 91
  • 1
  • 14
0
votes
2 answers

How to optimize a spatial query?

I need to optimize this query, 'coz execution time is too long. I've built gist indexes on geom(point), but they are not used unfortunaly. select *, cast(st_distance_sphere(city_gis.point, tmp1.pnt) as int) as distance from tmp1 …
user3306125
  • 215
  • 1
  • 4
  • 12
0
votes
1 answer

MySQL Spatial search for HSV (color) values?

Is it possible to use MySQL's spacial search to find points inside of a 3D polygon? Or better still, is it possible to use MySQL to find the values on the surface of an HSV cylinder?
Justin Alexander
  • 2,004
  • 3
  • 21
  • 25
0
votes
1 answer

postgresql query with ST_GeomFromText not working

I am trying to execute the Postgres query: SELECT a.a_geom FROM a WHERE ST_within(a.a_geom::geometry,ST_GeomFromText('Polygon((1,1),(4,1),(4,4),(4,1))')); but this query gives error : ERROR: parse error - invalid geometry SQL state: XX000 …
0
votes
1 answer

How to get features *not equal* to a spatial intersection?

I'm trying to get features back that are outside the intersection of themselves and a polygon defined in a query. When I run the query with the intersection set to true (ie. =1) the results are normal and expected. However, when I use the not equal…
DPSSpatial
  • 767
  • 3
  • 11
  • 31
0
votes
1 answer

update mysql table with results from spatial query

I am using mysql to count the number of point features (shops) within a polygon feature (postsec). The select query I have works fine, but I want to update table postsec with the generated results. The query I have is below: select pc_sec, count(*)…
Stev_k
  • 2,118
  • 3
  • 22
  • 36
0
votes
1 answer

postgresql Converting WKB to utm

I am using PostgreSQL with postgis, the geometries are in UTM and stored as WKB with several shapes types (point, polygon, linestring...). Is there a way to convert the wkb to a list of points in radians or utm? without the string parsing of the…
yoavba
  • 401
  • 2
  • 6
  • 13