QGIS SpatiaLite – How to Change Projection of SpatiaLite Layer

coordinate systemogr2ogrqgisspatialite

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

Best Answer

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

Related Question