0

I am interested in processing GeoPackage files in CLI (probably in linux). I know for example I can use ogr2ogr with the -spat option to crop OSM *.pbf file and convert it to SpatiLite DB.

But is it possible to directly work with the resulting database (best would be GeoPackage, but could also be SpatiaLite and finally converted to GPG)?

I mean tasks like renaming "attribute table" fields, filtering data, renaming items or merging / deleting fields and possibly also applying some predefined style.

I am asking because I would like to process OSM data (similarly to my blog post here) with some preconfigured script in CLI to perform all tasks automatically.

is it possible?

  • Renaming fields in SQLite is complicated stackoverflow.com/questions/805363/…. Making a temporary table with renamed fields, dropping the table and renaming back to original means quite a lot of tweaking because so many things are protected with triggers and constrains in both GeoPackage and SpatiaLite. I would not recommend to do that directly with SQL. But there are other things which are simple and safe to do with generic SQLite SQL tools. – user30184 Aug 12 '18 at 20:53
  • So you recommend to convert OSM *.pbf to sqlite, do all the renaming, filtering etc. and then finally convert the result to GPG? – Juhele Aug 12 '18 at 21:06
  • 1
    The best would be to plan what you do and give the correct names right ahead. Second best for my mind is to make initial conversion into gpkg and then then do the renaming by creating new tables with correct names with gpkg capable tools, drop the first versions, and vacuum. But with big tables that is slow, better to do it right in one run. – user30184 Aug 13 '18 at 5:02

Your Answer

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

Browse other questions tagged or ask your own question.