Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mysql]

MySQL is an open-source, relational database management system. Place you question on MySQL Spatial Extensions here.

0
votes
1answer
15 views

How to check whether a point is inside a polygon or not in MySQL

I am trying to get the points those are within the shape file. I have tried the Spatial functions and it's showing an error: 3033 - Binary geometry function st_contains given two geometries of ...
0
votes
0answers
17 views

Load GeoJSON generate from MySQL with PHP [on hold]

I need help with creating the code in the Leaflet to load GeoJSON using the PHP script. I tested the echo from PHP at http://geojsonlint.com/ and GeoJSON is showing it correctly has a good structure.
0
votes
0answers
13 views

Forming rectangle between two diagonal points using MySQL?

I've been working with Google Maps a bit lately and they provide a set of bounds (two points, northeast and southwest). ex. "bounds": { "northeast": { "lat": 34.111236 "lng": -118.2840872 ...
0
votes
0answers
6 views

MySQL group union

I want MySQL to merge many geographies together to form a single shape. A zipcode table has a row 'shape' containing a perimeter from Uncle Sam. Definition here: https://www.db-fiddle.com/f/...
1
vote
0answers
20 views

Result of ST_Contains gives false positive

I am trying to figure out the state that Berlin is in. So now my query SELECT * FROM states WHERE ST_Contains(Geo, Point(13.383068, 52.530644)); return two results. One for Berlin which is correct, ...
0
votes
1answer
60 views

Automatically refresh Leaflet Markers from MySQL

I have a leaflet map that loads marker details from a MySQL database. I have a timer that clears and reloads the layers (and therefore markers); however; it doesn't seem to be refreshing the data. ...
0
votes
0answers
44 views

MySQL get records for matching distance

I have a usecase where the user pass his location (latitude and longitude) to the backend, I have to get that location and find all the restaurant with in 30miles radius area for his location at the ...
2
votes
1answer
160 views

Server side clustering with geohash

I need help with clustering algorithm. I have a mysql database with lat, lng, geohash(12 chars). I am usign this query to select all records for zoom level 2 (2 chars) SELECT COUNT( id ) , LEFT( `...
0
votes
0answers
147 views

Find single nearest point of point in mysql

I have an app that formerly used PostgreSQL with PostGIS but now the environment changes and I have to use MySql. In my app i had a database query that searches the nearest point to a point. Note ...
0
votes
1answer
284 views

Why does mysql ST_WITHIN work for some MultiPolygons but doesn't for others?

The mysql queries are to return all POI's within a certain country. This works (for Angola): SELECT poi.poi_id, poi.poi_address_full FROM poi WHERE ST_WITHIN( poi....
0
votes
0answers
132 views

What msqyl field type to use for polygon and multipolygon city/country geojson from geonames

Which mysql field type should I use to store country and city boundaries? Mysql version: 5.7 Data source: Geonames shapes_all_low.txt (http://download.geonames.org/export/dump/) Issue: In this ...
0
votes
1answer
97 views

Spatial functions with MySQL, XAMPP, and Wordpress

I am trying to figure out how to using the ST_AsGeoJSON function in MySQL, but I keep getting an error that says that this function does not exist. I have found in the MySQL documentation that this ...
1
vote
1answer
148 views

MySQL 8 MBRIntersects 10 times slower than PostGIS equivalent

I'm trying to migrate a PostGIS database to MySQL 8 and am having a big performance hit when it comes to MBRIntersects. Using Mapbox to render vector tiles, I need to extract geometry intersecting ...
1
vote
0answers
39 views

Which approach is faster for getting all POIs from MySQL/MariaDB with PHP/Laravel [closed]

Correct me if I'm wrong. There are three approaches to get the nearest homes, users have created in my website: To create a table with two columns(latitude, longitude) that both of them are float ...
1
vote
0answers
49 views

MySQL ST_Contains returning empty recordset?

Using MySQL 5.6, I have converted lat and lng fields into Points - using AsText, I can see this is OK. I have another table to hold the polygon data, and again using AsText, I can see the correct ...
2
votes
0answers
150 views

Storing Shapely polygons in MySQL

I have to store some polygons in a MySQL database. The polygons are in Plate Carrée (ESPG 32662) projection, but I also tried to first converting them to the usual latitude-longitude projection (ESPG ...
0
votes
1answer
95 views

TurfJS + PHP + MySQL

I have a PHP endpoint/service that receives Lat/Long data from a 3rd party. The data is then processed in PHP code and saved into a MySQL database. This process works fine without any issues. I need ...
1
vote
1answer
80 views

Importing shapefile to SQL database, attributes are all NULL

I used ogr2ogr to import a shapefile into a MySQL database using the following: ogr2ogr MYSQL:"db,host=localhost,user=root" -nln "map" -a_srs "EPSG:4683" map.shp -overwrite -addfields -...
1
vote
0answers
518 views

Parsing GeoJSON in PHP?

i am trying to parse GeoJson from database with php but somehow i got an error and i cannot found any error in my script. here my script $id = 1; $db = new mysqli("localhost","root","","skriboo"); $...
0
votes
1answer
280 views

MySQL GPS distance calculation is failing

MySQL 5.6 here. I'm storing GPS coordinates as MySQL Point types in my DB and am trying to build a query that takes a single GPS coordinate (consisting of latitude and longitude components) and ...
2
votes
1answer
114 views

Lost geometry from QGIS mysql vector layer

I have a vector layer displaying geometry from a mysql view. This works fine for several days/weeks until suddenly it fails to refresh and my layer reverts to a non-geometry table, losing all symbols,...
0
votes
0answers
85 views

Increase the number of features returned IN ST_BUFFER MySQL

We are facing a problem. We are getting the same number of the features even if we change the ? d $command = $connection->createCommand("select astext(buffer(geomfromtext('POINT(-15....
0
votes
0answers
127 views

Get polygons within buffer Google Maps and MySQL

Problem statement: facing a small problem in get polygons within buffer // Select All polygons $command = $connection->createCommand("SELECT AsText(geom) as geom FROM `polygons` "); $...
1
vote
0answers
38 views

ArcGIS Near equivalent in MySQL?

I am trying to replicate a process in MySQL that I have had been through in ArcGIS thereby using MySQL to set up an automated system for extracting future climate predictions from downscaled data to ...
0
votes
0answers
306 views

MySQL GeoJSON query for polygons format error

Trying to take MySQL polygons to GeoJSON. My SQL query is Okay and works in PhpMyAdmin and I'm trying to modify some code that works for points. I think I'm close but stuck. In PhpMyAdmin the ...
15
votes
1answer
2k views

Where does the default Earth radius in ST_Distance_Sphere come from?

MySQL says in the docs for ST_Distance_Sphere Calculations use a spherical earth and a configurable radius. The optional radius argument should be given in meters. If omitted, the default radius is ...
4
votes
0answers
99 views

Position of vehicles relative to lead vehicle

I have a set of vehicles (think railway) that are in a (semi)fixed formation. I know the lead vehicle and I know the GPS coordinates of the lead vehicle at any given time. Sometimes, I can rely on the ...
1
vote
1answer
861 views

Correct method to save and restore leaftlet drawing into mysql database

I have the following code for saving my coordinates of what I draw. So what I do on drawing created I have the following function. map.on(L.Draw.Event.CREATED, function (e) { var type = e....
2
votes
0answers
224 views

Overpass API python wrapper to run requests on the endpoint of overpass-turbo

we have with Overpass API python wrapper a thin Python wrapper around the OpenStreetMap Overpass API https://github.com/mvexel/overpass-api-python-wrapper we have some Simple example: import ...
1
vote
0answers
521 views

Retrieve geolocation and image url from Blob in MySQL

I have a web form that collects three items: name, notes, and a geotagged img and stores it in mysql. The image is stored as a blob. I would like to scrape/access the blob's geo-location properties ...
1
vote
1answer
534 views

Select all points within a a geojson polygon from Mysql

I'm trying to get all points that are within each polygon from my database, but my sql query is not working. Can some one please help me out? The following is my sql code. Column cities_main_db....
1
vote
0answers
148 views

Exporting geodatabase attribute tables to MySQL database using ArcMap?

I've already created a mysql db connection using ODBC and tested it. Now I want to export the attribute tables data from ArcMap to mysql which is on my localhost. On export there are many options like ...
1
vote
2answers
150 views

Looking for geojson data host?

I want to use geojson data in google map application like this (enter link description here). The geojson data (see link enter link description here) is what I am looking for. Do I need a (online) ...
0
votes
0answers
1k views

A store locator with multiple categories using google api,php and mysql

I have created a store locator using google api, php and mysql, it is working fine. Now I am creating a select option for selecting the store categories and trying to display the stores which fall in ...
1
vote
2answers
1k views

How to convert polygon shapefile to CSV?

I can convert shapefile (having points) to CSV file, import in MySQL databases and then i can execute my queries for searching. Now I want to do same for polygon shapefile; that is, I want to convert ...
2
votes
1answer
335 views

howto set ogr2ogr imported SRID to 0? Currently defaulting to SRID 1

I'm currently trying to import a bunch of boundaries into a legacy system with a specific SRID. its a mySQL db. After import and running some intersect code, i receive this error: Binary geometry ...
0
votes
1answer
1k views

Hibernate and Mysql gives “Geometry byte string must be little endian.” error

I'm using mysql and wildly. I want to look for points in a given polygon. My method looks like: public Response getGeoJsonByBox( @QueryParam("topLeftX") double ...
1
vote
0answers
88 views

Less detailed FIPS polygons?

I'm working on a project which takes the NOAA NWS alerts and places them onto a Google Map. https://alerts.weather.gov/cap/us.php?x=0 Most alerts use the FIPS or UGC codes. I don't think I need the ...
2
votes
1answer
3k views

Convert lat/lon mysql columns to geometry, check if point is in polygon, return polygon id

I have a mysql database table with many ids, each id has a "start lat", "start lon" "end lat" and "end lon" column. I want to check in wich polygon the start point belongs (and write this in a "start ...
3
votes
0answers
66 views

In MySQL are there unidirectional and directional graphs?

I'm new to MySQL and studying about geospatial data. I have read the documentation of MySQL and learned about the ST_Geometry type, its subtypes and its functions; but I didn't find anything about ...
3
votes
1answer
468 views

View database connections in QGIS with Python

I am designing a GUI for a QGIS plugin I am developing, which is intended to plot information from a MySQL database. In the GUI, I would like to have a combo box of all the database connections saved ...
0
votes
1answer
432 views

to be able to use mysql-connector-python inside QGIS python script

I am creating python script in QGIS python console to be able to connect to mysql db and manipulate data (retrieve from db, generate shapefile and show it as a layer). I tried to install mysql ...
1
vote
0answers
352 views

Import non spatial data from MySQL DB into QGIS using queries

I want to import data from MySQL DB. MySQL schema has a lot of tables with a huge amount of data. This is non spatial data. I want to import objects as vector layers using sql query which is selecting ...
1
vote
0answers
212 views

Is it possible to incorporate QGIS shapefile / polygon to XAMPP?

I want to make a website using XAMPP but it must include a map of our city. I used QGIS to produce a shapefile of our city. I also want to use MySQL / MariaDB as the database but I don't know how to ...
0
votes
0answers
121 views

Import shapefile to mysql - wrong point coordinate order

I'm importing .shp file (OSM cities) to mysql 5.6 using ogr2ogr tool from command line (on Ubuntu, qgis). As a result I get a table with SHAPE field of type geometry. This is a list of points (city ...
0
votes
1answer
66 views

ArcMap to MySQL using Modelbuilder

Is it possible to run a model in ArcMap 10.3 and export directly to a MySQL table? Preferably avoiding ArcSDE as well.
4
votes
1answer
266 views

Mapserver hide OGR exception

I use mapserver 7.0.2 to display Points which are taken from a MYSQL-database. If the the SQL-statement fails (for example the database can't be reached) the mapserver gives out an OGR error-message, ...
2
votes
0answers
379 views

How to convert degree 2 utm in mysql?

This is my solution - I needed this as function, to use it in select-statement: CREATE DEFINER=`root`@`localhost` FUNCTION `deg2utm`(`lat` FLOAT, `lng` FLOAT, `utmzone` INT) RETURNS text CHARSET ...
0
votes
1answer
3k views

Passing data from mysql/PHP into Leaflet

I'm trying to add points to a Leaflet map. The points are stored in a MySQL database as latitude and longitude. I would like some leads and recommendations. <?php $showpoint = $bdd->...
1
vote
1answer
61 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 ...