0

I know that there are many many posts about this type of topic already, but all solutions did not work out for me so far.

I have a shapefile with polygons, which is described here and can be downloaded here (there is also a paper published in the Journal of Urban Economics, see this link). It comes as a geopackage. As the first link shows, the projection is World Mollweide (EPSG: 54009). I want to calculate zonal statistics for these polygons with various raster files, e.g. air quality (downloadable here (as .nc) or here (as .asc), which use the WGS84 projection. However, I just cannot manage to align the raster files with the shapefile.

I tried to save the polygons as a shapefile, assigning to it the WGS84 (EPSG: 4326) CRS. However, using QGIS 3.8 this results in a shapefile without any polygons/observations. With ArcGIS Map 10.7 or ArcGIS Pro 2.5, it tells me that I cannot export the shapefile. While ArcGIS aligns the CRS on the fly, it does not allow to compute zonal statistics (because of some mysterious error 99999).

Any suggestions how to solve this problem?

3
  • It sounds like you are just saving the geopackage as a shapefile and then assigning it WGS84 in QGIS? This approach would just confuse QGIS because the data are referencing the original CRS but you are telling it to use a different unit of measure. Better to use QGIS to save the geopackage as a shapefile with the CRS that matches the raster CRS. The ESRI 999999 error is typical when you are using an operation that uses vector data with raster data and the CRS do not match.
    – GBG
    Jul 15 '20 at 17:30
  • I first set up a link to the geopackage in QGIS, right-click the layer and then click "Add Layer to Project". Then QGIS tells me that CRS was undefined and that it is "defaulting to project CRS WGS1984 EPSG 4326" (maybe here is the problem?!). Next, I right-click the layer and perform Export --> Save Features As... and I save them as an ESRI shapefile using the WGS84 EPSG 4326 CRS. I thought that this step was saving "the geopackage as a shapefile with the CRS that matches the raster CRS". Or what do I get wrong?
    – philsch
    Jul 16 '20 at 10:51
  • Yes, If the CRS is undefined you will need to figure out what that is before fussing with or defining a CRS. Garbage in garbage out.
    – GBG
    Jul 16 '20 at 16:05
0

If this type of problem occurs to someone:

Before adding the layer you need to set the project CRS to Mollweide (EPSG 54009), because otherwise QGIS is confused. Then you can add the layer and save it in the alternative CRS like WGS84 in my case. After adding the new layer to the project, you change the project CRS to WGS84 and everything works.

(thanks to @CBG for the helpful comment)

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.