Questions tagged [mysql-spatial]

MySQL implements spatial extensions following the specification of the Open Geospatial Consortium (OGC).

mysql-spatial
Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

MySQL spatial query doesn't always join rows that it should

Using MySQL 8.0.35-0ubuntu0.23.04.1, the following query returns 116 rows with precincts where districtgroup='municipality' when this line is uncommented: -- used.districtgroup in ('municipality')...
ratsbane's user avatar
  • 890
0 votes
0 answers
45 views

MySQL 8.0.35 doesn't select addresses when coordinates whithin polygon

I created a minimum SQL code to reproduce an issue that I have CREATE SCHEMA `test` DEFAULT CHARACTER SET utf8mb4; use test; create table addresses ( id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, ...
amarynets's user avatar
  • 1,805
0 votes
0 answers
54 views

MySQL ST_GeomFromText is not recognizing query LINESTRING('...')

Trying to transform a set of points in a LINESTRING gives me an error SELECT way_nodes.way_id, ST_GeomFromText( CONCAT('LINESTRING(', GROUP_CONCAT(CONCAT(ST_X(...
Juliana Aragão's user avatar
0 votes
0 answers
23 views

Mysql Query to get one co-ordinate in 10 mete radius

In the database we have multiple latitude and longitude in 10 meter circle. So I need a query which will fetch only one latitude and longitude in every 10 meter radius. I am expecting to get only one ...
subhashish's user avatar
1 vote
0 answers
132 views

How to get all the objects in a table where the coordinates intersects with polygon with SQL Spatial Data

I have an SQL table which called DATAB which contains thousands of objects ordered by the following colunms: [id] [angel] [latitude] [longitude] And i have this polygon set with STPolyFromText: ...
JonasBH's user avatar
  • 41
1 vote
1 answer
155 views

ST_EQUALS is not returning correct result?

I've come to these weird results when running ST_EQUALS on two Polygons: SELECT ST_EQUALS( ST_GEOMFROMTEXT( 'POLYGON((81.65 34.8667,81.65 5.9167,75.9833 34.8667,75.9833 5.9167,81.65 34.8667))',4326), ...
Qais Abou Housien's user avatar
0 votes
1 answer
196 views

How To find the nearest distance along a polyline Mysql

I am building a ride sharing application. The application has a feature for searching drivers. The drivers (employees in a work hub) can choose a route to their destination from the app. The ...
user avatar
0 votes
0 answers
588 views

What is the JSON format to pass POINT data type values?

I am using Java, Spring boot, MySQL and data JPA. Check my code here @Column(name = "point", columnDefinition = "POINT") private Point point; And in my application.properties file, I've Added ...
Lokesh Ch's user avatar
0 votes
1 answer
109 views

How to translate a PostGIS query to MySQL spatial query

I need to translate this PostGIS query: SELECT boundary ST_Intersects(ST_SetSRID(ST_Buffer(ST_MakePoint(11.255492,43.779251),0.002), 4326), ST_GeomFromKML(boundary)) as intersect, FROM ...
DaFois's user avatar
  • 2,217
2 votes
2 answers
1k views

Import spatial data from PostGIS into MySQL

I have a PostgreSQL DB that contains KML data in one column of a table. I query it with postGIS commands with a query like this: SELECT ST_geomFromKML(geometry) ST_Intersects(ST_SetSRID(...
DaFois's user avatar
  • 2,217
0 votes
1 answer
434 views

ogr2ogr error: "Unable to initialize connection to the server ...."

I am getting the error detailed in the screenshot below when running ogr2ogr. The command used worked on my other computer. I am wondering if this is an error that is triggering because I do not have ...
DIDS_421's user avatar
0 votes
1 answer
501 views

MySQL 8.0 ST_CONTAINS returns records outside polygon, and misses records within polygon

I'm facing discrepancies when using mysql's st_contains. I have a table of zones which has their latitude and longitude columns, I simply want to query all records that fall within the polygon. When ...
Ron's user avatar
  • 513
0 votes
1 answer
264 views

mysql calculate distance for returnning location

This is not a duplicate of: Find distance between two points using latitude and longitude in mysql I tried the query and it's not working, I get empty data set and 0 as the answer. SEE ...
yenk's user avatar
  • 219
3 votes
1 answer
880 views

Get min/max POINTs from a POLYGON object

I have a table with a geom column containing polygons. e.g.: POLYGON((-104.98075 25.83706,-84.659531 25.83706,-84.659531 49.38449,-104.98075 49.38449,-104.98075 25.83706)),4326 How can I extract ...
Colin's user avatar
  • 2,169
0 votes
1 answer
571 views

Overriding Laravel Model View

I'm attempting to handle map marker locations as natively as possible using MySQL spatial data types. I don't want to resort to additional columns for lat and lng, as eventually, I want to be able to ...
Erich's user avatar
  • 2,549
0 votes
0 answers
195 views

MySql spatial: `ST_Contains(g1,g2) || ST_Touches(g1, g2)` vs `ST_distance(g1,g2)=0`

I use mysql spatial functions. I have to understand if points lies withing multipolygon.Birder must be included. My expriments showed that ST_Contains does not include border of Multipolygon So for ...
gstackoverflow's user avatar
5 votes
2 answers
2k views

Mysql: ST_Contains with borders to detect if multipolygon contains point

I use mysql spatial functions. I have to understand if points lies withing multipolygon. Initially I used MBRContains but it works in a strange way, so I faced the following error: Mysql function ...
gstackoverflow's user avatar
1 vote
1 answer
3k views

doctrine querybuilder syntax error expected =, <, <=, <>, >, >=, !=, got end of string

Having following error: "[Syntax Error] line 0, col -1: Error: Expected =, <, <=, <>, >, >=, !=, got end of string." building this query with doctrine querybuiler : SELECT *...
jj-aa's user avatar
  • 1,029
1 vote
1 answer
1k views

How to unpack MySQL Multipoint geometry data in PHP?

Okay, so I think I'm close here, but I'm hitting a limitation in my understanding of binary data. I'm parsing some MySQL data inserted as geometry types, using PHP's unpack() as my parser, and ...
wosevision's user avatar
3 votes
1 answer
7k views

How to insert point in mySQL table

I get an mySQL error saying 'ADDRESS_LONGI_LATIT_LOCATION' can not be null. Likely that 'geomfromtext/pointfromtext' is returning a null. Whats wrong here? Any help is appreciated. INSERT INTO ...
PCG's user avatar
  • 2,279
0 votes
2 answers
426 views

Mysql: find polygon within certain radius

In my database I have polygons stored. Now I need to search all the polygons that are within a certain radius. Even if the polygon is only a small part inside the region, then it should be included ...
Wouter De Ruyck's user avatar
0 votes
0 answers
208 views

Routing Algorithm with Spatial SQL

currently, I search for a solution to speed up my code. I have a DB with different geometrical components (Points, Polygons). Each Structure is given by several properties called Con_Number (default: ...
Jacks's user avatar
  • 67
1 vote
2 answers
665 views

What type of data are returned by the X() and Y() MySql functions that take a point field as parameter

I am not so into database. Into a geospatial query I have something like this: SELECT X(gps) AS longitude, Y(gps) AS latitude FROM MyTable Where the gps field hve point as type. And it returnes ...
AndreaNobili's user avatar
  • 41.9k
0 votes
1 answer
304 views

How can I correctly set the value of a field having type point in a MySql database?

I am not so into geospatial data and I have the following problem. I am using MySql and I am finding some difficulties trying to add the value of a field having point as type in this table rows. I ...
AndreaNobili's user avatar
  • 41.9k
1 vote
0 answers
718 views

MySQL ST_Buffer minimum radius

I have a series of polygons stored in a MySQL table that I need to return as exploded polygons which are a minimum of a given distance from the original. The ST_Buffer function performs a very ...
Nibbles's user avatar
  • 11
1 vote
1 answer
7k views

Invalid GIS data provided to function st_geometryfromtext in MySQL

Here is my error: Error Number: 3037 Invalid GIS data provided to function st_geometryfromtext. Here is my code: SELECT ST_Within(ST_GEOMFROMTEXT('POINT(12.971201 077.652038)'), ST_GEOMFROMTEXT('...
Blesson Christy's user avatar
0 votes
2 answers
108 views

Spatial Geomety SQL - two exact same queries one works the other doesn't

This is bizzarre I have a database that stores polygons and a query running that checks if a point exists within any polygon and retrieves them. However when the query is created as an sql string in ...
Ali's user avatar
  • 7,433
0 votes
1 answer
103 views

Why I obtain different values calculating distance between two point in the space using this "Great-circle distance" formula and Google Earth tool?

I am not so into database and GIS and I have the following doubt about this function used on a MySql database to calculate the distance between 2 points. I am started from this tutorial where there ...
AndreaNobili's user avatar
  • 41.9k
0 votes
1 answer
355 views

Why I obtain this error when I try to create this funcion (that use point data type) on a MariaDB database?

I am not so into database and I have the following doubt implementing this tutorial: https://mariadb.org/jquery-and-gis-distance-in-mariadb/ So basically my doubt is relate to this SQL statment that ...
AndreaNobili's user avatar
  • 41.9k
0 votes
0 answers
442 views

How to convert in km the distance of this MySql geographical query that inds all the points of interest into a distance range from a center point?

I am not so into database and I am working on a MySql geographical query that have to find all the points of interest that are into a specified distance range from a center point. Following this ...
AndreaNobili's user avatar
  • 41.9k
1 vote
1 answer
1k views

What is the units of measure used in this MySQL geo query that finds all the points having a specific distance from a center point?

I am working on a MySQL geographical query. So, following this tutorial: http://howto-use-mysql-spatial-ext.blogspot.it/2007/11/using-circular-area-selection.html I have implemented this query that ...
AndreaNobili's user avatar
  • 41.9k
0 votes
0 answers
74 views

Why point insertion giving error?

I am using this statement to insert data into database. cursor.execute('INSERT INTO scats_data(id,geometry,NB_SCATS_SITE,QT_INTERVAL_COUNT,NB_DETECTOR,DAY_OF_WEEK,V00,V01,V02,V03,V04,V05,\ V06,...
Arjun Chaudhary's user avatar
0 votes
1 answer
429 views

MySQL spatial query

I had a normal table. Now i added a spatial column ALTER TABLE roadData ADD pt POINT ; and now my table has null values : Now in MySQL tutorial insert statement is used: INSERT INTO geom VALUES (...
Arjun Chaudhary's user avatar
12 votes
1 answer
3k views

Mysql function MBRContains is not accurate

I have the following POLYGON (in the image you can see the area it covers) POLYGON((-74.05100448502202 4.7239278424321,-74.05092938316898 4.7241416902206,-74.04830618275201 4.7237460717602,-74....
Oscar Gallardo's user avatar
0 votes
1 answer
652 views

MYSQL geospatial function using table data and ST_Distance_Sphere

This is my query which attempts to return the distance from a specific point to all the records in a table. This is the Table creation CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, ...
Count Zero's user avatar
0 votes
1 answer
203 views

NHibernate.Spatial.MySQL: Null geometries and "No persister for: GeoAPI.Geometries.IGeometry" error

I am attempting to create a simple demo solution using NHibernate.Spatial.MySQL (version 4.0.4.4001). The solution is available here: https://github.com/andrerav/NHibernate.Spatial.MySql.Demo The ...
andrerav's user avatar
  • 393
1 vote
1 answer
308 views

Not getting expected output from doctrine query as getting mysql native sql query, I am using doctrine2-spatial extension

I am fetching sites which comes within a polygon, using following native sql query. And its giving me number of site ids. SELECT s.siteID from Sites s where st_contains( (SELECT polygon from Region ...
vikram eklare's user avatar
1 vote
0 answers
118 views

Executes when startPoint and endPoint are in same road

Can you suggest the code to find the routing when the startpoint and endpoint are in the same road in sql server SET @e = ( SELECT TOP 1 a.target FROM Routes a WHERE a.geom....
JACK's user avatar
  • 11
1 vote
1 answer
1k views

MySQL: how to get lat/lgn values from GEOMETRY column?

If a series of latitude and longitude values are stored in a GEOMETRY column in MySQL, is there a way to get back those values once it's been stored as a geometry data type? Sample data: CREATE TABLE ...
StackOverflowNewbie's user avatar
0 votes
1 answer
220 views

MySQL: can't returning a POINT type using WHERE clause

i have some points stored in a MySQL database, they are stored as POINT types with an x and y value. I am trying to search and return specific points using the x and y values in a WHERE clause. ...
ThriceGood's user avatar
  • 1,673
2 votes
0 answers
136 views

How to insert an mpoly in Mysql using WKB data

I'm trying to insert a mpoly WKB data into MySQL, which I get from a PostgreSQL dump. My table looks like this: CREATE TABLE `region` ( `id` int(11) NOT NULL AUTO_INCREMENT, `is_active` tinyint(1)...
Nuschk's user avatar
  • 518
1 vote
1 answer
210 views

MySQL and splitting spacial data

I have a MySQL table that we are using for storing of some latitude and longitude. The coordinates are defined as a 'geometry' type column and can contain any number of coordinate pairs. When I run ...
user1721373's user avatar
3 votes
2 answers
4k views

Doctrine 2 Spatial Data

I am having extreme difficulty making this doctrine2 extension works. It is https://github.com/djlambert/doctrine2-spatial and theres not a lot of doc on how to create a polygon. I got the config ...
delmalki's user avatar
  • 1,336
-3 votes
1 answer
175 views

Spatial query in sql database

hi I am currently developing a geo location based app which updates the user's location and displays the shops around him, I am using ordinary sql queries in sql database .My php code to select the ...
user3781907's user avatar
3 votes
0 answers
500 views

Construct lineString from points in mysql

Giving the following table (Position) +--------------------+---------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra ...
user3410658's user avatar
5 votes
2 answers
2k views

What is the unit of measurement used in MySQL's spatial Buffer call?

The Buffer call is formatted Buffer(g,d). g is a geometry value (e.g. point, linestring, and polygon). d is a distance. What unit of measurement is d using? Meters? Miles? Kilometers?
James Chevalier's user avatar
1 vote
1 answer
330 views

Mysql Join on three tables containing spatial data

I have three tables Outlets (shopId, shopName,shopLatitude,shopLongitude,g) (450 Rows) g is of type geometry and contains value point(latitude longitude) Offers (offerId,...
Zach's user avatar
  • 10k
1 vote
2 answers
3k views

Create geometry (f.e. LineString()) from stored points. MySQL spatial

Is there any way to create some Geometry (f.e. LineString(pt1,pt2,...)) from MySQL query (where pt1,pt2,... is a result of another query, in other words pt1,pt2,... stored in MySQL table)? Example: ...
Yaroslav's user avatar
  • 651
0 votes
2 answers
836 views

How to pass a value returned from inner query to outer query

I am using a nested query for fetching records within a certain radius. I want to order the response by distance and also pass the distance as one of the parameter in response. here is the query I a ...
Zach's user avatar
  • 10k
1 vote
0 answers
101 views

Create a rectangle with user location as centre of it

I am trying fetch all points within 50 km radius of user location from MySQL. For this I am using spatial data. I am trying to execute this query select lat, lon from geom where MBRContains( ...
Zach's user avatar
  • 10k