3

I'm trying to combine a few Spatialite Databases into a single database, so that I can properly reference them, etc. I don't care about referencing them to one another (No foreign keys, etc), but I would like to get them all into a single database. Any suggestions on how I might accomplish this?

As an example, say I'm trying to combine the key tables from this spatialite database with the ones here. I want to ensure that the geometry information is copied.

I'm running on Windows 7, and would prefer to not use a different OS to accomplish this.

5

If you're familiar with SQL, probably the easiest way is to use the capabilities of the underlying SQLite database to "mount" one database onto another (or perhaps both source databases onto a new target database. The SQLite SQL command for this is ATTACH.

Conceptually, you'd then SELECT / UPDATE from the source database table(s) into the target table. The exact approach will depend on exactly what you want from the results.

I would caution you that the databases on GeoCommons aren't (or at least, weren't last time I checked) "real" SpatiaLite databases (more like SQLite + FDO), so I'd try to bring in the data via Extended Well Known Binary (EWKB) or similar rather than just copying the blobs across.

  • Forgive my ignorance, but what is EWKB? – PearsonArtPhoto Nov 15 '13 at 3:18
  • Expanded that acronym - its a format originally from PostGis (I believe), that is like Well Known Binary (WKB), but includes the SRID. – BradHards Nov 15 '13 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.