I have a presentation next month on MySQL and GIS. MySQL
8.0 has benefited greatly from the three dimensional libraries
from Boost.Geometry. There are many facets to the Geographic Data
world that it is damn near impossible not to lurch down one
rabbit hole into another in an unending spiral of acronyms,
standards, projections, and functions. But thankfully I
have MySQL Workbench to aid me.
Texas
I wanted some test data to use for some GIS exercises and was
very happy to find many useful sets curated by the OpenStreetMaps
folks. Shapefiles are used to hold the various data points of an
item of interest. I had assumed that the data would have
some sort of longitude/latitude pairs but was wondering what I
would need to do to work with that data and what ever came
bundled with it. I download the Texas data and then …
The past couple of blog entries have been on Geographic
Information Systems and Geometric Data. Visualizing that
data with MySQL Workbench makes it easier for me to see what the
results really mean.
Workbench 8.0.15 will draw the polygon with the Spatial View Option |
So how do you get there?
Start Workbench, create a new SQL Tab in your favorite scratch
schema, and crate the table below.
CREATE TABLE `test` (
`id` INT NOT NULL AUTO_INCREMENT,
`geom` GEOMETRY NULL,
PRIMARY KEY (`id`));
Next add some data.
INSERT INTO `test` …
The last blog entry was very popular and there were
lots of requests for some introductory information on the spatial
data types.
Well Known Text Or Binary
I am going to use the GEOMETRY data type over POINT, LINESTRING,
or POLYGON as it can store any of those three while the other
three can only contain data matching their name (so POINT can
holds only point data, etc.). The values are stored in an
internal geometry format but it takes wither WKT or WKB formatted
data.
Those are Well-Known Text (WKT) or Well-Known Binary (WKB)
formats repectively. I am hoping most of your are better with
text than binary so the following examples demonstrate how to
insert geometry values into a table by converting WKT values to
internal geometry format.
So let us start with a …
MySQL has had spatial indexes for many years, but they have all been Cartesian (X and Y coordinates) indexes. MySQL 8.0 adds support for geographic (latitude-longitude) indexes. In an earlier blog post, I described how the feature works. In this post, we’ll go into the details of how to upgrade from 5.7 to 8.0 if you have spatial indexes.…
This post talks about how we make use of Boost.Geometry in MySQL to implement reliable and efficient GIS functionality, as well as changes to the GIS features in the lab release. Now that InnoDB is the default storage engine for MySQL, our user base is rapidly transitioning to InnoDB. One capability that they have been demanding is a performant and scalable GIS implementation. Along with adding R-tree index support to InnoDB, we also decided to replace the original GIS algorithms with a more powerful, reliable, effective and efficient geometric engine.