...

/

Spatial Data Types and Formats

Spatial Data Types and Formats

Discover the spatial data types and formats available in MySQL.

We'll cover the following...

We need to manage various spatial data types in our startup that offers rides with e-scooters in Berlin. We require a system that can handle different spatial entities to organize the structure effectively. For instance, we track the locations of our e-scooters, which are represented as points. Additionally, we delineate specific zones where customers can park the e-scooters. Furthermore, the routes taken by our customers are recorded as paths, which, for simplicity, we treat as sampled locations connected by lines.

To manage these spatial entities efficiently, we need a database management system that supports spatial data types, including points, polygons, and multilines. MySQL is well-suited for this task as it offers comprehensive support for spatial data types by implementing the OpenGIS geometry model.

Spatial data types

The OpenGIS model defines a hierarchy of geometries, including Point, Curve, Surface, and GeometryCollection, with Geometry being the root. However, not all these entities are directly usable; for example, Curve and Surface cannot be instantiated. Instead, LineString and its subtypes (Line and LinearRing), as well as Polygon, extend their respective non-instantiable entities to become usable. GeometryCollection allows for combining different spatial types, such as MultiPoint, MultiCurve/MultiLineString, and MultiSurface/MultiPolygon, with only the latter instantiable variants usable. This model can be understood by drawing parallels with Java programming, where non-instantiable entities are akin to abstract classes, and their instantiable counterparts are like concrete classes. ...

Access this course and 1400+ top-rated courses and projects.