GIS types and data import

Use a disposable v4.2.5 database. POINT enforces subtype and SRID columns enforce the reference system; generic GEOMETRY accepts points, lines and polygons.

DROP DATABASE IF EXISTS gis_basic_402;
CREATE DATABASE gis_basic_402;
USE gis_basic_402;
CREATE TABLE shapes(id INT PRIMARY KEY, g GEOMETRY);
INSERT INTO shapes VALUES (1,ST_GeomFromText('POINT(1 2)')),(2,ST_GeomFromText('LINESTRING(0 0,3 4)')),(3,ST_GeomFromText('POLYGON((0 0,2 0,2 2,0 2,0 0))'));
SELECT id,ST_AsText(g),ST_SRID(g) FROM shapes ORDER BY id;
SELECT ST_AsText(ST_GeomFromWKB(ST_AsWKB(g))) FROM shapes WHERE id=1;
SELECT ST_AsText(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[1,2]}',0));
CREATE TABLE points(g POINT SRID 4326);
INSERT INTO points VALUES (ST_GeomFromText('POINT(1 2)',4326));
SELECT ST_SRID(g) FROM points;
DROP DATABASE gis_basic_402;

The first rows use SRID 0. POINT(1 2) round-trips through WKB/GeoJSON and the constrained column reports 4326. GeoJSON defaults to 4326; the example explicitly requests 0.

In separate negative statements, insert LINESTRING into POINT and SRID 0 into a 4326 column; expect rejection. Compare GEOMETRY32 and GEOMETRY at large coordinates/small separations to expose float32 loss.

For bulk import preserve hashes, coordinate order, CRS/SRID and source provenance. Read back WKT/GeoJSON and reconcile rows, NULLs and invalid geometries. Assigning SRID does not transform coordinates. See the GIS introduction.