0

I created a SpatiaLite layer from Geofabrik OSM data (.pbf) using ogr2ogr. When I load the data into QGIS it only shows up as WGS84. I would like to change it to ESRI:102003 or similar so i can do measurements in metric.

Do I need to re-convert the data and add a CRS tag to the command?

Changing it in QGIS 3 causes it to render off the map.

ogr2ogr -f "SQLite" -dsco SPATIALITE=YES 2021.db texas_2021.pbf

1 Answer 1

2

You have a few options:

  1. Don't define the projection in your ogr2ogr command and then tell QGIS when you add the data that it is in WGS84 and QGIS will reproject it on the fly to the map CRS (not recommended)

  2. Use -a_srs EPSG:4326 in your ogr2ogr command to define CRS is WGS84 and QGIS will know how to reproject it on the fly

    ogr2ogr -f "SQLite" -dsco SPATIALITE=YES -a_srs EPSG:4326 2021.db texas_2021.pbf

  3. Change the coordinate reference system from EPSG:4326 to ESRI:102003 with -s_srs EPSG:4326 -t_srs ESRI:102003

    ogr2ogr -f "SQLite" -dsco SPATIALITE=YES -s_srs EPSG:4326 -t_srs ESRI:102003 2021.db texas_2021.pbf

1
  • A bit of an update on this. Changing the crs worked well (step 3). Step 2 didn't work. It would show has having the correct crs but wouldn't display correctly. I'm not sure why but I don't have time to troubleshoot it. I didn't bother with step 1.
    – brink
    Commented Mar 25, 2022 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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