1

I am simply trying to take a raster layer and overlay a polygons vector layer on top and then run zonal stats on the polygons using the raster layer, but when I look at the my raster layer and then add the polygons vector layer, the polygons are nowhere to be seen. I can use "Zoom to Layer" to go to the polygons, but see that they are in a whole other space, totally nowhere near the raster image. I have tried setting the CRS of each layer to the same, but this does not work. I am using QGIS.

Here are the details of my raster layer: enter image description here

And here are the details of my polygons vector layer: enter image description here

As you can see, the CRS is the same. I made sure of it, after I used "Reproject Layer" to set this CRS for the vector layer. But still, they do not overlap. What might I be missing here and how can I fix this?

UPDATE: Before I load in polygons shapefile I see this: enter image description here

I then choose the highlighted conversion operation.

The details remained the same after I tried to change the CRS via "Reproject Layer".

LostinSpatialAnalysis
  • 979
  • 1
  • 11
  • 21
  • The problem might lay before you reproject. If the layers are orginally not in the correct projection before you reproject, reprojecting will not work, because the source crs is not correct to begin with. – Binx Jul 11 '22 at 18:08
  • 3
    If you look at the Extent property, you can see the raster and polygon layers have different values. This means they have different crs. Can you please post an image of your original shapefile layer? How did you obtain it? – Binx Jul 11 '22 at 18:10
  • I updated my post with some clarifying info, but my original shapefile was just something processed in python using geopandas. I wasn't sure I really did anything special to it. I did use this line though in creating the shapefile: Original_Polygons = gpd.read_file("Original_Polygons.shp") followed by Original_Polygons = Original_Polygons.set_crs(epsg=2263, allow_override=True) and then Original_Polygons.to_file("Original_Polygons.shp") and then opened in QGIS. Please let me know if this more info is needed, I wasn't sure an image of the polygons themselves would really help much here. – LostinSpatialAnalysis Jul 11 '22 at 18:26
  • 4
    Do never "set" the CRS (if you're not 100% sure what you do). You can reproject a layer, but simply "setting" (assigning) a CRS in almost all cases will result in the layer disappearing in a place where it does not belong. See here for details: https://gis.stackexchange.com/a/392388/88814 and https://gis.stackexchange.com/a/383437/88814 – Babel Jul 11 '22 at 19:12
  • Did you create the Original_Polygons.shp or did you obtain it from somewhere? Can you print(Orginal_Polygons.crs)? – Binx Jul 11 '22 at 19:46

0 Answers0