sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

MySQL Spatial Data Types

Open nik-here opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Similar to #166 there are missing spatial types for MySQL.

Describe the solution you'd like

using the geo crate: https://crates.io/crates/geo

And add geo to the feature list in the Cargo.toml

Describe alternatives you've considered

Alternativly geo-types could be used.

Additional context

https://dev.mysql.com/doc/refman/8.1/en/spatial-types.html

nik-here avatar Sep 05 '23 21:09 nik-here

I prefer to use geo-types, because geo::geometry::* is a re-export of geo_types::geometry::*.

An additional discussion is whether we need a wrapper structure (or a (Geometry<f64>, i32)) to handle SRID.

AFAIK, geo_types::Geometry and subtypes do not contain SRID. Since MySQL 8.0, MySQL server supports SRID for GEOMETRY types.

If wrapper structure is necessary, I prefer to support both native geo_types::Geometry and the wrapper, like json does.

mirromutth avatar Feb 22 '24 05:02 mirromutth

Since geozero already provides integration with SQLx for PostGIS types, I think this should live there.

abonander avatar Aug 13 '24 21:08 abonander