Dolt Supports Every Type

SQL
3 min read

If you haven't heard, Dolt is a version controlled database, kinda like if Git and MySQL had a baby. Not too long ago, we announced partial support for Spatial Data Types. Since then, we've received requests for the rest of the Spatial Types, so we delivered. As a result, Dolt, starting from release v0.50.6 now supports every type MySQL does.

Look at all those green check marks:

green

What are Multi-Geometries

The last types we implemented are "MultiGeometries". MultiGeometries are simply sets of their counterparts. A MultiPoint is a set of Points, a MultiLineString is a set of LineStrings, and so on. An interesting note is that a GeometryCollection (a set of any Geometry) can be empty, while the other Multi-Geometries can't be.

Connect-the-Dots

We can make use of MultiPolygons to improve the Connect-the-Dots book from our previous Spatial Types blog.

The new table can be defined like so:

dolt> CREATE TABLE dots_book_2 (page int PRIMARY KEY AUTO_INCREMENT, name VARCHAR(128), drawing MULTIPOLYGON);

Now, rather than having different rows for each of our drawings, they can all go in a single row.

dolt> INSERT INTO dots_book_2 (name, drawing) VALUES (
    "dolt logo",
    ST_GEOMFROMTEXT("MULTIPOLYGON(
        ((1 1,1 4,3 4,3 5,4 5,4 1,1 1),(2 2,2 3,3 3,3 2,2 2)),
        ((5 1,5 5,8 5,8 1,5 1),(6 2,6 4,7 4,7 2,6 2)),
        ((9 1,9 2,10 2,10 4,9 4,9 5,11 5,11 2,12 2,12 1,9 1)),
        ((14 1,14 3,13 3,13 4,14 4,14 5,15 5,15 4,16 4,16 3,15 3,15 2,16 2,16 1,14 1))
        )"
    )
);

Here are some other fun shapes for our book

dolt> INSERT INTO dots_book_2 (name, drawing) VALUES (
    "star",
    ST_GEOMFROMTEXT("MULTIPOLYGON(
        ((0 5,3 5,4 8,5 5,8 5,5.5 3,6.5 0,4 2,1.5 0,2.5 3,0 5))
        )"
    )
);
dolt> INSERT INTO dots_book_2 (name, drawing) VALUES (
    "illusion1",
    ST_GEOMFROMTEXT("MULTIPOLYGON(
        ((0 1,0 6,1 7,1 2,5 2,5 1,0 1)),
        ((1 7,6 7,7 6,2 6,2 2,1 2,1 7)),
        ((7 6,7 1,6 0,6 5,2 5,2 6,7 6)),
        ((6 0,1 0,0 1,5 1,5 5,6 5,6 0))
        )"
    )
);
dolt> INSERT INTO dots_book_2 (name, drawing) VALUES (
    "illusion2",
    ST_GEOMFROMTEXT("MULTIPOLYGON(
        ((2.5 2.5,3 2,2 1,0 3,2 5,5 2,6 3,5 4,4 3,3.5 3.5,5 5,7 3,5 1,2 4,1 3,2 2,2.5 2.5)),
        ((2 4,5 1,7 3,7 2,5 0,2 3,2 4)),
        ((1 3,2 4,2 3,1.5 2.5,1 3)),
        ((4 3,5 4,5 3,4.5 2.5,4 3)),
        ((5 4,6 3,5.5 2.5,5 3,5 4)),
        ((0 3,2 1,2 0,0 2,0 3)),
        ((2 1,3 2,3.5 1.5,2 0,2 1))
        )"
    )
);

DBeaver is a great database tool that has very useful GIS mapping functionality. Here are the results of our dots_book_2.

Page 1

dolt_logo

Page 2

star

Page 3

illusion1

Page 4

illusion2

Conclusion

We're closer than ever to our goal of full MySQL compatibility, but we're not done yet. A key feature on our Spatial Types roadmap is Spatial Indexes, so stay tuned for more improvements and better support for Spatial Types. If you have any specific Spatial Types features (or other database and versioning features), feel free to make an issue on our (Github)[https://github.com/dolthub/dolt]. Need help or have any questions? Join our Discord.

SHARE

JOIN THE DATA EVOLUTION

Get started with Dolt

Or join our mailing list to get product updates.