Questions tagged [spatial]

Storing, querying, and indexing spatial data (including geometric and geographic representations).

Filter by
Sorted by
Tagged with
1
vote
1answer
24 views

RDS MySQL 8.0.16 has empty “INFORMATION_SCHEMA.ST_SPATIAL_REFERENCE_SYSTEMS” table

On aws RDS I have an mysql 8.0.16 instance running. My problem is now, that the INFORMATION_SCHEMA.ST_SPATIAL_REFERENCE_SYSTEMS table is empty. This is a problem for me because I would like to create ...
4
votes
1answer
94 views

CONVERT_IMPLICIT when inserting a Geography datatype into a Geography datatype column on Temp Table

@@Version Microsoft SQL Server 2008 R2 (SP3) - 10.50.6220.0 (X64) If I try to insert data into a geography datatype in a temp table I get a CONVERT_IMPLICIT, converting a Geography datatype to a ...
6
votes
1answer
183 views

MSSQL Geography STIntersects returns 1 when 0 is expected

I'm experiencing an MSSQL Geography issue I can't explain. Assume that I'm math-challenged, but it seems like the following point should NOT intersect the following polygon: DECLARE @t_point ...
1
vote
2answers
225 views

Should I join all of my polygons to make a single polygon for point-in-polygon search?

I have a set of of polygons. Sometimes they are completely disconnected (like separate patches). Other times, two sides of two polygons may touch each other (when the polygons are adjacent like on a ...
0
votes
0answers
36 views

Visualization Of Graph Data With Spital Drawing SSMS

I want to create a visualization of my graph database utilizing Spatial Drawing within SSMS. How do we connect the various polygons with node names and to from pointers? The layout should preferably ...
0
votes
0answers
16 views

Reducing contiguous values in geographical data to a set of polygons?

I've got a MySQL table with about 200,000 rows in it. The table has four columns, lat, lng, and value. value is just a percentage, and represents your chances of seeing an aurora in the night sky for ...
9
votes
2answers
4k views

Does MySQL store point datatypes as LAT LNG or LNG LAT?

I'm used to seeing location format as latitude followed by longitude, but using libraries, I believe I understand MySQL to store it as POINT(LNG LAT), the reverse order. Is my library in the wrong, or ...
0
votes
1answer
35 views

How to create Polygon from Point datatype in MySQL?

I have a table like this: CREATE TABLE `aois` ( `aois_id` int(11) NOT NULL DEFAULT '0', `WS_A` point DEFAULT NULL, `WS_B` point DEFAULT NULL, `WS_C` point DEFAULT NULL, `WS_D` point DEFAULT ...
2
votes
1answer
39 views

Efficient way to store geographical routes in MongoDB

I need to store a taxi route into MongoDB, however I'm not sure what is the best way to do this. Since the route is only needed for the taxi order, the first idea I had is to store it in the order, ...
4
votes
1answer
268 views

Spatialite: use of virtual spatial index for distances

I'm currently learning to use spatial access methods for query optimization. I'm going through the examples in spatialite cookbook and got stuck in here http://www.gaia-gis.it/gaia-sins/spatialite-...
2
votes
2answers
301 views

How to dump a postgreSQL/postgis sample database filtered by a spatial extent?

My goal is to extract a subset of my postgres/gis database to create a sample dump which has to have the same data model with relations between tables and views, but which has a smaller spatial extent....
4
votes
1answer
136 views

Can SQL Server use a spatial index and another index at the same time and be efficient?

Let's say we have a table that contains two terrain datasets defined by TerrainModelID like below: CREATE TABLE [dbo].[DigitalTerrain]( [DigitalTerrainID] [uniqueidentifier] NOT NULL, [...
4
votes
1answer
1k views

Does PostgreSQL/PostGIS use R-Tree or R*-Tree?

PostgreSQL and PostGIS offer to create indexes over GiST with pretty much the same code. On 2D items, "This gives R-tree behavior" is what it says in the PostgreSQL source comments. However, it is a ...
0
votes
1answer
91 views

Optimised way to search over 2 milllion poi data in mysql

We have over 2 million poi data in our mysql db. At any time we need to find what is the nearest point based on the following formula found at this link http://sqlfiddle.com/#!2/abba1/4 select *, ( ...
0
votes
1answer
80 views

Sharding a MongoDB instance by a spatial key and a date

This may be more an advice than anything else, but I'm designing an app that stores in a table objects that have a 2dsphere index and they also have a date (+time), both of them being part of queries ...
0
votes
1answer
39 views

Oracle GIS database replacement [closed]

My company has a huge (hundreds of millions of records) Oracle database of GIS/temporal information. We are trying to switch to an open source alternative. If it helps, we imagined the following ...
15
votes
3answers
8k views

PostgreSQL vs. MySQL: spatial feature comparison

We are the in the process of building out a web application that has a spatial data component. In the beginning our spatial data comparisons will take a given point and return matched overlapping ...
1
vote
2answers
339 views

implement geo / spatial / proximity search with php and mysql — what have you done successfully [closed]

For my website's users, I want to implement a worldwide geo / spatial / proximity search with php and mysql. I want to do this as simply and minimally as possible. What is the minimum data I should ...
1
vote
1answer
43 views

Can I restrict a SQL Server spatial field to hold values of specified spatial types and SRIDs?

I am trying to understand geography data types so I can integrate my database more closely with GIS processes. From my reading, it appears that a geography field can hold many different types of ...
0
votes
1answer
67 views

Spatial Query using MySQL 8.0

I have a database in MySQL 5.7 where I create a Lat/Long column using "POINT", then I create a Index on this column with main key as second column. So my database is like PID, SurveyID, GeoPoint ...
2
votes
1answer
236 views

RDS: permission denied for relation spatial_ref_sys when copying

I am copying tables using ogr2ogr from Oracle to PostGIS. When I run try to load these I get, ERROR 1: ERROR: permission denied for relation spatial_ref_sys when copying <table>@AWS
1
vote
1answer
50 views

SDO_NN the second nearest neighbor

Oracle SQL geometry allows me to find the nearest neighbor using SDO_NN(neighbors.GEOLOC,p.GEOLOC,'SDO_NUM_RES=1 UNIT = MILE',1) = 'TRUE') How can I get the select the second nearest point?
3
votes
1answer
146 views

Mysql 8 ST_GeomFromText giving error Latitude out of range in function st_geomfromtext. It must be within [-90.000000, 90.000000]

I am trying the following insert query on mysql 8. Insert Into fence Set fenceName='aa', radius=2, fenceGeometry=ST_GeomFromText('POINT(...
0
votes
0answers
28 views

How to create an Index on a raster column?

In a PostGIS enabled DB, I have a 1.7GB table with a raster column rast. I need to create an index on that column in order to speed up my raster queries. I have tried the following: CREATE INDEX ...
6
votes
1answer
82 views

How do I force SQL Server to use my spatial index through a view?

I have tables which holds transactions for properties that are stored as lat long pairs. (There are more columns and datapoints then in my example schema). A common request is to find the ...
2
votes
1answer
536 views

Longitude and Latitude order with ST_X, and ST_Y on SRID 4326

I have a MySQL 8.0.15 and I am experimenting with the geo-spatial location functions. I have applied SRID 4326 to the "loc" column. Nothing in the docs other than the primitive Point() suggests the ...
2
votes
1answer
649 views

MongoDB Using String-Type Shard Key for Zone Ranges

Mongo lets any field type be used to set ranges for Shard Zones, but doesn't specify how analyses are conducted. My goal is to point queries and writes at the exact right server, WITHOUT using a ...
4
votes
2answers
2k views

SQL geography::point null parameter error when parameter is not null?

I was getting this error: 'geography::Point' failed because parameter 1 is not allowed to be null. On this sql: SELECT [ID], geography::Point([lat], [long], 4326) AS [loc] FROM ( SELECT [ID], ...
2
votes
1answer
2k views

How do I create a point with an SRID in MySQL?

MySQL supports using ST_PointFromText to construct a point with an SRID, ST_PointFromText(wkt[, srid [, options]]) Constructs a Point value using its WKT representation and SRID. This ...
1
vote
1answer
38 views

Filtering a MySQL table on multiple columns, including one with spatial data

I have a MySQL table with linestrings: CREATE TABLE edges ( id int(11) unsigned NOT NULL AUTO_INCREMENT, geometry linestring NOT NULL, type_key varchar(255) NOT NULL, created_at datetime NOT ...
1
vote
1answer
363 views

MySQL 8 Geospatial Queries, MakeEnvelope Workaround?

I'm trying to work with some data from Google Maps and have a few locations along with their bounding boxs (northeast, southwest) data stored. Using that data, I have the following query... SELECT ...
1
vote
0answers
34 views

Spatial index unused on nested set

I'm using the nested set architecture to store URL hierarchies in the following InnoDB table on MySQL 5.7. From my research, I've learnt that using a SPATIAL index will significantly speed up any ...
4
votes
1answer
547 views

Does MySQL or MariaDB support GIS KNN Index Queries (k-nearest neighbors)?

Can you do k-nearest neighbors algorithm (k-NN) queries on MySQL for example, to find the nearest point in PostgreSQL with PostGIS, I can run a kNN query on the spatial index with <-> SELECT ...
1
vote
1answer
42 views

SQL to find nearest location in one table from locations in another

I have a table like this, that contains a few million locations (POINT): CREATE TABLE NewLocations( [NewName] [varchar](20), [NewLocation] [geometry] ) I have another table like this, that ...
0
votes
2answers
201 views

Update all geometry points by adding/subtracting from XY

I want to update the POINT geometry column for all rows in a table. For example, I want to change POINT(1 1) to POINT(1.1 .9) UPDATE myTable SET geoPoint = asText(geoPointX+1 geoPoint Y-1) The ...
1
vote
1answer
145 views

MSSQL Spatial performance (point in polygon)

Discolsure: This is a cross post from GIS, however the group over there isn't necessarily focused I have a query, below, that works - however its very slow, looping through roughly 24,000 points per ...
2
votes
1answer
70 views

Is it possible to add a spatial index to a partition with Postgres 10?

I am creating declarative partitions like: CREATE TABLE mydata.my_features ( id bigint, my_feature1 character(1), my_feature2 integer, ... my_geom geometry ) PARTITION BY ...
0
votes
1answer
87 views

Does MySQL or MariaDB support a LineString constructor that takes points?

It seems with MySQL and MariaDB I'm getting the following when I try to use the LineString constructor. In PostGIS I can do this with ST_MakeLine(pt1,pt2) > SELECT ST_MakeLine(Point(0,0), Point(0,...
0
votes
2answers
3k views

mySQL changing output unit of ST_Distance function

I'm trying to get a result in nautical miles between two lon/lat saved in a point data type field in mySQL. However, the result seems to be not in any unit I'm familiar with (maybe degrees). How can I ...
0
votes
0answers
66 views

SQL Server - Cannot reorganize index on “extended_index” table

I have a maintenance plan that includes an index reorganization step. I am getting the following error in the job history: Executing the query "ALTER INDEX [SpatialIndex-20180705-165942] ON [dbo......
1
vote
0answers
147 views

How to group-by to get MultiPoint/GeometryCollection in MySQL?

I have a table x like this: Columns: SubjectID int(11) Timestamp bigint(20) fix_geom point When i try to group my fix_geom column to a MultiPoint (or GeometryCollection) by SubjectID, like: ...
9
votes
4answers
580 views

Problem getting zips in radius via MySQL

I have a table of zip codes which includes the center lat, lng for each zip code. I use it to get a list of zip codes within a given mile radius from any arbitrary point. It just occurred to me that, ...
0
votes
2answers
529 views

Converting spatial data from Oracle to MySQL

This is a followup to this question: Problem getting zips in raius via MySQL I have some spatial stuff in an Oracle table. MDSYS.SDO_GEOMETRY(2003,4326,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),...
0
votes
1answer
64 views

Do the type-specific WKT- constructors function differently from ST_GeomFromText?

From the docs on MariaDB, for ST_LineStringFromText Constructs a LINESTRING value using its WKT representation and SRID. ST_LineFromText(), ST_LineStringFromText(), ST_LineFromText() and ...
0
votes
1answer
110 views

How do I construct a LINESTRING by aggregating Points (ST_MakeLine) in MariaDB?

Let's say I have a table with 3 points, CREATE TABLE foo ( id int PRIMARY KEY, geog point ); INSERT INTO foo (id, geog) VALUES ( 1, Point(0,0) ), ( 2, Point(1,1) ), ( 3, Point(2,2) ); How can ...
17
votes
3answers
30k views

What's the difference between POINT(X,Y) and GeomFromText(“POINT(X Y)”)?

I'd like to store some geometric positions in my MySQL database. For this I use the POINT datatype. Almost everywhere I read that the function GeomFromText should be used to insert data in the table. ...
5
votes
2answers
13k views

How can I store latitude and longitude without PostGIS?

I know there are similar questions on here that have been answered but unfortunately none of them work for me. I am hacking my way through creating a page which will display multiple locations on a ...
2
votes
2answers
248 views

What is the SQL command to get 20 closest points from some center location

There are 1.6 million rows. Must not compute distance for all rows. Spatial index is available This is the table structure. The name of the table is businessauxiliary. So yes I used MyIsam, added ...
1
vote
1answer
388 views

ERROR: invalid GeoJson representation

the GeoJSON Spec show, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [125.6, 10.1] }, "properties": { "name": "Dinagat Islands" } } But when I wrap that in ...
3
votes
1answer
67 views

What is the proper type for columns holding GeoJSON?

What data type do you prefer for columns holding GeoJSON information, in the major RDBMS families (i.e. Oracle DB, PostgreSQL, MySQL, SQL Server, SQLite, DB2..? In general, do you prefer / is better ...