Created
July 1, 2010 13:14
-
-
Save jgomezdans/459943 to your computer and use it in GitHub Desktop.
Importing the geonames DB into Spatialite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE geonames ( geoname_id int, name text, asciiname text, alternatenames text, latitude real, longitude real, feature_class text, feature_code text, country_code text, cc2 text, admin1 text, admin2 text, admin3 text, admin4 text, population integer, elevation integer, gtopo30 integer, timezone integer, modification_date text) ; | |
.separator \t | |
.import allCountries.txt geonames | |
ALTER TABLE geonames ADD COLUMN geom blob ; | |
UPDATE geonames SET geom = PointFromText ( 'POINT(' || longitude || ' ' || latitude || ')', 4326 ) ; | |
SELECT RecoverGeometryColumn ( "geonames", "geom", 4326, "POINT", 2) ; | |
SELECT CreateSpatialIndex ( "geonames", "geom") ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment