23 votes

Where does the default Earth radius in ST_Distance_Sphere come from?

Ok, this is hilarriuusss. I tracked this down. In an old copy of lwgeom/lwgeom_spheroid.c in PostGIS 1.0.0rc4 you can see this, /* * This algorithm was taken from the geo_distance function of the *...
Evan Carroll's user avatar
  • 7,071
5 votes

QGIS show WKT from attribute table

If it's just for visualization you could use the geometry generator with the same expression: geom_from_wkt("WKT") To set it up you may duplicate your layer (so you will get one layer with ...
J.R's user avatar
  • 16.3k
4 votes

Find features within given coordinates and distance using MySQL

It's 2020, you should be using the built in spatial function of the RDBS. In this case you are after the ST_Distance function. -- geo column in users table is of Geometry data type, with a spatial ...
John C's user avatar
  • 159
4 votes

How to show QGIS maps in android application?

You can use Opensourse JavaScript libraries like leaflet or Openlayers to create a web appilication using the maps created using QGIS with the help of GeoServer and load it into a webview in your ...
KcYoosuf's user avatar
  • 123
4 votes

Parsing WKB with python geos: ParseException: Unknown WKB type 16

So, in a nutshell: this is actually a MySQL binary blob of wkt. With AsText(column) I was able to get a normal wkt format, and then parse it with shapely/geopy: d = pd.read_sql_query('''SELECT AsText(...
Philipp_Kats's user avatar
  • 1,984
4 votes

Passing data from mysql/PHP into Leaflet

OK, so the main struggle (and obvious error) is the newbie mistake of not controlling which code runs in PHP in the server, which code runs in JS in the browser, and not having control over which ...
IvanSanchez's user avatar
  • 10.2k
4 votes

Mapserver hide OGR exception

This is fixed in Mapserver-7.0.3 and backported to other versions (6.0.5, 6.2.3, 6.4.4). Looks like Kain's question was taken as a bug report which was subsequently fixed. See OGR error messages too ...
Pete's user avatar
  • 343
4 votes

View database connections in QGIS with Python

You can do it in this way: from PyQt4.QtCore import QSettings self.settings = QSettings() self.settings.beginGroup( '/MySQL/connections/' ) connections = self.settings.childGroups() # [u'adsb', u'...
Germán Carrillo's user avatar
4 votes

Server side clustering with geohash

While the geohash representation is convenient, it is not designed with spatial queries in mind. From my understanding of the Geohash algorithm you can't just select all the points inside a given ...
chkaiser's user avatar
  • 1,114
3 votes

How do I update joined data from MySQL programmatically?

Might I suggest creating a macro which contains a function to rejoin both your layers. Using this method then allows you to run the function from the Python console whenever you want to update the ...
Joseph's user avatar
  • 75.8k
3 votes

Convert Ordnance Survery (GB) Easting/Northing data to WGS84 lat/long

However, the X/Y co-ordinates in my dataset are Ordnance Survey (GB) Easting and Northing. Ordnance Survey provide a very useful conversion spreadsheet (https://www.ordnancesurvey.co.uk/docs/...
Mintx's user avatar
  • 5,396
3 votes

Creating line-strings from points in MySQL

I shifted over to PostgresSQL and it was fairly simple there, just had to use ST_MakeLine(geom)
Hasan Mustafa's user avatar
3 votes

MySQL Using ST_CONTAINS to obtain points within a bounding box

For anyone having the same problem - the answer is that an incorrect syntax was being using for the POLYGON declaration. The POLYGON should have been declared using the following method: SET @g1 = ...
Alexander's user avatar
  • 171
3 votes

ArcMap to MySQL using Modelbuilder

You can connect to MySQL using OLE DB connection and then use the connection in your model. If you can, it might be easier to write a tiny Python script that you could invoke as part of the model. In ...
Alex Tereshenkov's user avatar
2 votes

Different results given by PostGIS and MySQL?

This question was asked ½ a decade ago, but things have changed since then. As stated in @Mapperz’s comment, 5.6 is the first version of MySQL with true full-shape spatial geometry operators and ...
Joel_MMCC's user avatar
  • 121
2 votes

Converting Shapefile to MySQL?

The best available answer is to use ogr2ogr to import shape files. FWtools is a great tool to import shape files into mysql here is an example ogr2ogr -f MySQL MySQL:database_name,host=localhost,user=...
hashir ilyas's user avatar
2 votes

Does MySQL only support bounding boxes calculations instead of the real polygon geometry?

The accepted response is fairly outdated for the current state of the art. MySQL 5.6 has decent support for the OGC data types on MyISAM tables. You probably don't want to use MyISAM tables though. ...
Jacob Dalton's user avatar
2 votes

Find features within given coordinates and distance using MySQL

It might be base to create a function .. so you can reuse it other other areas. Also would make your query a bit cleaner... At least that is my 2 cents. DELIMITER $$ CREATE FUNCTION calcDistance(...
eDriven_Levar's user avatar
2 votes

Can joined tables be served by QGIS Server WFS?

I can confirm that joined tables are properly served by QGIS server as WFS my setup: postgres geometry_table postgres attribute_table The tables are joined by QGIS desktop (add geometry table as a ...
anneb's user avatar
  • 1,371
2 votes

Displaying MySQL database as layer on map?

If you're familiar with ESRI js framework you can use MapET Spatial Feature Server. It exposes services compliant to GeoServices REST Specification Version 1.0
Lou Lou's user avatar
  • 68
2 votes

Displaying MySQL database as layer on map?

If you're open to non-ESRI options, you could create a GDAL VRT file that defines your MySQL layer(s) as a spatial dataset, then you could use any software that can consume the VRT, for example ...
elrobis's user avatar
  • 6,456
2 votes

How to filter OSM data for addr keys with Osmosis

Osmosis has option for tag filter. here is the documentation. https://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage_0.46#--tag-filter_.28--tf.29 Example usage: osmosis \ --read-xml input.osm \ ...
neogeomat's user avatar
  • 8,380
2 votes

MySQL database layers invisible in QGIS

there is an active ticket on this issue: https://hub.qgis.org/issues/13836
paolo's user avatar
  • 31
2 votes

Reduce query time when using both MySQL and PostgreSQL with PostGIS

The following query solve my issue SELECT name, area, district, ST_Distance_Sphere(geom,'POINT($longitude $latitude)'::geometry) as distance FROM poi ORDER BY poi.geom <->'POINT($longitude $...
Devils Dream's user avatar
  • 3,179
2 votes

How to Geocode 300,000 addresses on the fly?

by far the best and easiest geocoder I have used https://pypi.python.org/pypi/geocoder/1.8.0 bing maps, google maps, OSM etc..
ziggy's user avatar
  • 4,515
2 votes

ArcPy: Connect to MySQL database

I run the process on a server where both the 64-bits and 32-bits versions of Python are installed, as the server holds both ArcGIS Desktop and ArcGIS Server. By default, the 64-bit version is ...
Hélène's user avatar
  • 1,161
2 votes

Vincenty's formulae to calculate in MySQL and PHP

With points as close as these we can ignore what type of spheroid the earth is and use the eqirectangular projection Pythagoras formula is all that is required. The following two functions are in PHP....
david strachan's user avatar
2 votes

Load coordinates from database to Google Maps

You could use software like MapServer or GeoServer to read your database and provide the data as a layer of layers as part of a WMS and/or WFS. So you use Java to populate the database, and a WMS/...
nmtoken's user avatar
  • 13.4k
2 votes

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

Google Earth is probably calculating distance over the earth as a spheroid, taking account for the not-quite-spherical nature of the earth. Also, your earth radius is probably a smidge big, try 6371 ...
Paul Ramsey's user avatar
  • 19.9k
2 votes

Looking for geojson data host?

If the data is not sensitive or private in nature and does not violate any organizational data policies it is possible to host GeoJSON on GitHub. See documentation. Simply commit the file as you would ...
danagerous's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible