3

I have 1 vector layer (counties) and 1 raster layer (population density). I have tried merging these two, so that I can examine population density within a county, but I have had no luck. It just gives me columns with NULL.

I did the standard thing, which is to calculate Zonal Statistics. My raster layer is an asc file, and I have tried converting it to a tif. Nothing has worked.


I got my population data from the History Database of the Global Environment (HYDE).


Okay, it could be because my CRS projections aren't the same for the vector and raster layers. When I set both the same, however, the map completely screws out of whack, with the vector layer being off-map completely! What do I do?

  • 1
    There are 2 Zonal Statistics, one being a core plugin and the other available to download. Have you tried both just incase? Otherwise, there is an alternative method mentioned here: gis.stackexchange.com/questions/22601/… – Joseph Aug 26 '14 at 10:32
  • 2
    Is the raster layer created from the same vector layer? I barely use raster layers but I would probably suggest that you reproject the raster layer with the same CRS as the vector layer and see if that helps: Raster > Projections > Warp (Reproject) – Joseph Aug 26 '14 at 10:53
  • I have never had any luck working with vector and raster together. I always convert to one or the other and then back to the desired format in the end – Pat Aug 26 '14 at 12:03
  • 1
    There is a distinction between setting a dataset to a CRS and reprojecting a dataset to a different CRS. If they lined up before, it sounds like you have set instead of reproject. As for some of the answers, while you cannot merge two geometry or data types together, some tools can take both as inputs. Zonal Statistics in both QGIS and ArcGIS is one such tool, so it sounds like the CRS issue might be the cause of the problem. – Chris W Aug 26 '14 at 20:07
3

As Pat has mentioned, you cannot merge different geometry types together, just as you cannot merge polygons and lines together, or points with polygons. Your question needs to be edited to provide more information as to what you are hoping to do, or have as an outcome. If you have if you want to merge two datasets together to get more area, then convert the raster to a polygon, and then merge the two polygon datasets. If you want to merge attributes, then you could either convert the polygon to a raster and then merge the two raster datasets in raster calculator. Either way you can't merge different geometries together, and you need to explain your issue further.

2

There is two ways:

  1. you can transform the raster to vector and then merge the two vectors.
  2. you can extract the centroid of the counties and then extract the values of the raster in this points.

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.