Skip to content

Instantly share code, notes, and snippets.

@greut
Created August 24, 2015 14:02
Show Gist options
  • Select an option

  • Save greut/6ace07c98659bb313318 to your computer and use it in GitHub Desktop.

Select an option

Save greut/6ace07c98659bb313318 to your computer and use it in GitHub Desktop.
Inserting Neuchâtel into a spatial index.
CREATE TABLE cities (
id INT AUTO_INCREMENT,
code INT NOT NULL,
name VARCHAR(127) NOT NULL,
kanton CHAR(2) NOt NULL,
g GEOMETRY NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY (code),
UNIQUE KEY (name),
SPATIAL INDEX (g)
) ENGINE=MyISAM;
INSERT INTO cities (code, name, kanton, g) VALUES (
2000,
"Neuchâtel",
"NE",
POINT(46.9895828, 6.9292641)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment