Skip to main content
Added link to PostgreSQL documentation
Source Link
thayer
  • 151
  • 7

If I am understanding you right you started out with an NLCD raster and a polygon feature class of your grids. You then converted the raster to polygon within each of your grids cells to yield polygons with the corresponding NLCD land cover class.

Spatial Analyst Approach: I would redesign your workflow as follows: Before converting to polygons I recommend using the Zonal Statistics tool on the original NLCD, with your zones being the grid polygons and the NLCD land cover class being the value. You set the statistics field to be 'MAJORITY'. You then use the Raster Calculator tool to convert anything that is not of the majority land cover class to no data.

SetNull([NLCD]<>[zonalstat], [zonalstat])

What remains will be a raster of only the majority land cover. You could similarly use the Reclass tool. Then you can do your conversion to polygon, the resulting polygons will have the only majority land cover. You should note however that if more than one land cover class has the same number of cells only one will be returned by this procedure. So you may want to do Zonal Statistics as Table to find grids that have more than one land cover in the majority status.

SQL approach: For an SQL based approach on your area polygons, you can try the Make Query Table tool if you have a geodabase. I have never used it so I do not know how powerful it is. YouYour SQL you would need to usebe something like this:

SELECT grid_id, land_use_class, max(area) OVER (PARTITION BY area) 
FROM table
WHERE area = max(area)

ButYou can take a look at the Window Functions documentation for PostgreSQL for more detail.

But you may want to check that your polygons did not get split, for example by an area of different land cover in between two areas of the same land cover. You need to make multipolygons when you convert from raster, otherwise your dominant land cover could be masked because the dominant is not contiguous.

If I am understanding you right you started out with an NLCD raster and a polygon feature class of your grids. You then converted the raster to polygon within each of your grids cells to yield polygons with the corresponding NLCD land cover class.

Spatial Analyst Approach: I would redesign your workflow as follows: Before converting to polygons I recommend using the Zonal Statistics tool on the original NLCD, with your zones being the grid polygons and the NLCD land cover class being the value. You set the statistics field to be 'MAJORITY'. You then use the Raster Calculator tool to convert anything that is not of the majority land cover class to no data.

SetNull([NLCD]<>[zonalstat], [zonalstat])

What remains will be a raster of only the majority land cover. You could similarly use the Reclass tool. Then you can do your conversion to polygon, the resulting polygons will have the only majority land cover. You should note however that if more than one land cover class has the same number of cells only one will be returned by this procedure. So you may want to do Zonal Statistics as Table to find grids that have more than one land cover in the majority status.

SQL approach: For an SQL based approach on your area polygons, you can try the Make Query Table tool if you have a geodabase. I have never used it so I do not know how powerful it is. You would need to use something like:

SELECT grid_id, land_use_class, max(area) OVER (PARTITION BY area) 
FROM table
WHERE area = max(area)

But you may want to check that your polygons did not get split, for example by an area of different land cover in between two areas of the same land cover. You need to make multipolygons when you convert from raster, otherwise your dominant land cover could be masked because the dominant is not contiguous.

If I am understanding you right you started out with an NLCD raster and a polygon feature class of your grids. You then converted the raster to polygon within each of your grids cells to yield polygons with the corresponding NLCD land cover class.

Spatial Analyst Approach: I would redesign your workflow as follows: Before converting to polygons I recommend using the Zonal Statistics tool on the original NLCD, with your zones being the grid polygons and the NLCD land cover class being the value. You set the statistics field to be 'MAJORITY'. You then use the Raster Calculator tool to convert anything that is not of the majority land cover class to no data.

SetNull([NLCD]<>[zonalstat], [zonalstat])

What remains will be a raster of only the majority land cover. You could similarly use the Reclass tool. Then you can do your conversion to polygon, the resulting polygons will have the only majority land cover. You should note however that if more than one land cover class has the same number of cells only one will be returned by this procedure. So you may want to do Zonal Statistics as Table to find grids that have more than one land cover in the majority status.

SQL approach: For an SQL based approach on your area polygons, you can try the Make Query Table tool if you have a geodabase. I have never used it so I do not know how powerful it is. Your SQL you would be something like this:

SELECT grid_id, land_use_class, max(area) OVER (PARTITION BY area) 
FROM table
WHERE area = max(area)

You can take a look at the Window Functions documentation for PostgreSQL for more detail.

But you may want to check that your polygons did not get split, for example by an area of different land cover in between two areas of the same land cover. You need to make multipolygons when you convert from raster, otherwise your dominant land cover could be masked because the dominant is not contiguous.

added 747 characters in body
Source Link
thayer
  • 151
  • 7

If I am understanding you right you started out with an NLCD raster and a polygon feature class of your grids. You then converted the raster to polygon within each of your grids cells to yield polygons with the corresponding NLCD land cover class.

ISpatial Analyst Approach: I would redesign your workflow as follows: Before converting to polygons I recommend using the Zonal Statistics tool on the original NLCD, with your zones being the grid polygons and the NLCD land cover class being the value. You set the statistics field to be 'MAJORITY'. You then use the Raster Calculator tool to convert anything that is not of the majority land cover class to no data.

SetNull([NLCD]<>[zonalstat], [zonalstat])

What remains will be a raster of only the majority land cover. You could similarly use the Reclass tool. Then you can do your conversion to polygon, the resulting polygons will have the only majority land cover. You should note however that if more than one land cover class has the same number of cells only one will be returned by this procedure. So you may want to do Zonal Statistics as Table to find grids that have more than one land cover in the majority status.

SQL approach: For an SQL based approach on your area polygons, you can try the Make Query Table tool if you have a geodabase. I have never used it so I do not know how powerful it is. You would need to use something like:

SELECT grid_id, land_use_class, max(area) OVER (PARTITION BY area) 
FROM table
WHERE area = max(area)

But you may want to check that your polygons did not get split, for example by an area of different land cover in between two areas of the same land cover. You need to make multipolygons when you convert from raster, otherwise your dominant land cover could be masked because the dominant is not contiguous.

If I am understanding you right you started out with an NLCD raster and a polygon feature class of your grids. You then converted the raster to polygon within each of your grids cells to yield polygons with the corresponding NLCD land cover class.

I would redesign your workflow as follows: Before converting to polygons I recommend using the Zonal Statistics tool on the original NLCD, with your zones being the grid polygons and the NLCD land cover class being the value. You set the statistics field to be 'MAJORITY'. You then use the Raster Calculator tool to convert anything that is not of the majority land cover class to no data.

SetNull([NLCD]<>[zonalstat], [zonalstat])

What remains will be a raster of only the majority land cover. You could similarly use the Reclass tool. Then you can do your conversion to polygon, the resulting polygons will have the only majority land cover. You should note however that if more than one land cover class has the same number of cells only one will be returned by this procedure. So you may want to do Zonal Statistics as Table to find grids that have more than one land cover in the majority status.

If I am understanding you right you started out with an NLCD raster and a polygon feature class of your grids. You then converted the raster to polygon within each of your grids cells to yield polygons with the corresponding NLCD land cover class.

Spatial Analyst Approach: I would redesign your workflow as follows: Before converting to polygons I recommend using the Zonal Statistics tool on the original NLCD, with your zones being the grid polygons and the NLCD land cover class being the value. You set the statistics field to be 'MAJORITY'. You then use the Raster Calculator tool to convert anything that is not of the majority land cover class to no data.

SetNull([NLCD]<>[zonalstat], [zonalstat])

What remains will be a raster of only the majority land cover. You could similarly use the Reclass tool. Then you can do your conversion to polygon, the resulting polygons will have the only majority land cover. You should note however that if more than one land cover class has the same number of cells only one will be returned by this procedure. So you may want to do Zonal Statistics as Table to find grids that have more than one land cover in the majority status.

SQL approach: For an SQL based approach on your area polygons, you can try the Make Query Table tool if you have a geodabase. I have never used it so I do not know how powerful it is. You would need to use something like:

SELECT grid_id, land_use_class, max(area) OVER (PARTITION BY area) 
FROM table
WHERE area = max(area)

But you may want to check that your polygons did not get split, for example by an area of different land cover in between two areas of the same land cover. You need to make multipolygons when you convert from raster, otherwise your dominant land cover could be masked because the dominant is not contiguous.

Forgot some steps, and changed the overall method.
Source Link
thayer
  • 151
  • 7

If I am understanding you right you started out with an NLCD raster and a polygon feature class of your grids. You then converted the raster to polygon within each of your grids cells to yield polygons with the corresponding NLCD land cover class.

I would redesign your workflow as follows: Before converting to polygons I recommend just using the Zonal Statistics As TableZonal Statistics tool on the original NLCD, with your zones being the grid polygons and the NLCD land cover class being the value. This will give you a table withYou set the statistics for each gridfield to be 'MAJORITY'. From that table youYou then use the 'majority' and 'sum' statisticsRaster Calculator tool to convert anything that is not of the majority land cover class to no data. Majority

SetNull([NLCD]<>[zonalstat], [zonalstat])

What remains will give yoube a raster of only the most frequentmajority land cover in each grid. You would then divide the 'sum' bycould similarly use the 'majority'Reclass tool. Then you can do your conversion to getpolygon, the count of cells of that typeresulting polygons will have the only majority land cover. You then calculate the area by multiplying the count by the cell size squared (so for the NLCD that should be roughly 900 square meters).

The statistics tablenote however that if more than one land cover class has the id for the original grid sosame number of cells only one will be returned by this procedure. So you would just join the tablemay want to do Zonal Statistics as Table to find grids that have more than one land cover in the original grid polygonsmajority status.

If I am understanding you right you started out with an NLCD raster and a polygon feature class of your grids. You then converted the raster to polygon within each of your grids cells to yield polygons with the corresponding NLCD land cover class.

I would redesign your workflow as follows: I recommend just using the Zonal Statistics As Table tool on the original NLCD, with your zones being the grid polygons and the NLCD land cover class being the value. This will give you a table with the statistics for each grid. From that table you use the 'majority' and 'sum' statistics. Majority will give you the most frequent land cover in each grid. You would then divide the 'sum' by the 'majority' to get the count of cells of that type. You then calculate the area by multiplying the count by the cell size squared (so for the NLCD that should be roughly 900 square meters).

The statistics table has the id for the original grid so you would just join the table to the original grid polygons.

If I am understanding you right you started out with an NLCD raster and a polygon feature class of your grids. You then converted the raster to polygon within each of your grids cells to yield polygons with the corresponding NLCD land cover class.

I would redesign your workflow as follows: Before converting to polygons I recommend using the Zonal Statistics tool on the original NLCD, with your zones being the grid polygons and the NLCD land cover class being the value. You set the statistics field to be 'MAJORITY'. You then use the Raster Calculator tool to convert anything that is not of the majority land cover class to no data.

SetNull([NLCD]<>[zonalstat], [zonalstat])

What remains will be a raster of only the majority land cover. You could similarly use the Reclass tool. Then you can do your conversion to polygon, the resulting polygons will have the only majority land cover. You should note however that if more than one land cover class has the same number of cells only one will be returned by this procedure. So you may want to do Zonal Statistics as Table to find grids that have more than one land cover in the majority status.

Source Link
thayer
  • 151
  • 7
Loading