-
-
Save Rodolfocartas/4e70fbe110f111e3ba321418408cc2b5 to your computer and use it in GitHub Desktop.
Importar archivo de localidades de inegi a 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
PRAGMA encoding="UTF-8"; | |
CREATE TABLE localidades ( clave_entidad text, entidad text, clave_mpo text, municipio text, clave_loc text, localidad text, ambito text, latitude real, longitude real) ; | |
.separator , | |
.import localidades.csv localidades | |
ALTER TABLE localidades ADD COLUMN geom blob ; | |
UPDATE localidades SET geom = PointFromText ( 'POINT(' || longitude || ' ' || latitude || ')', 4326 ) ; | |
SELECT RecoverGeometryColumn ( "localidades", "geom", 4326, "POINT", 2) ; | |
SELECT CreateSpatialIndex ( "localidades", "geom") ; |
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
select InitSpatialMetaData("1"); | |
CREATE TABLE localidades ( clave_entidad text, entidad text, clave_mpo text, municipio text, clave_loc text, localidad text, ambito text, latitude real, longitude real) ; | |
.separator , | |
.import localidades.csv localidades | |
ALTER TABLE localidades ADD COLUMN geom blob ; | |
UPDATE localidades SET geom = PointFromText ( 'POINT(' || longitude || ' ' || latitude || ')', 4326 ) ; | |
SELECT RecoverGeometryColumn ( "localidades", "geom", 4326, "POINT", 2) ; | |
SELECT CreateSpatialIndex ( "localidades", "geom") ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment