How can I divide my shapefile polygon into smaller equal size area(20km2) using Polygon Divider, whenever I am trying to do a same size polygon shapefile generated?
2 Answers
I think the issue is related to the CRS of your file. When you use Polygon Divider plugin you need to make sure that the size you choose is appropriate using the projection of the polygon.
For example, I have polygon shapefile with a UTM Projection:
I put 10000 km2 as the desired size in CRS unit which UTM:
Here is the output with attribute showing the Area:
Make sure you are not using geographic spatial reference (WGS84) or any other projection that is not in meter unit. If you are in geographic CRS, you need to reproject your polygon layer with an appropriate CRS of meter unit.
-
Can you suggest me which CRS I should use, currently I've selected WGS 84 (OTF enabled). When I am using the following command "ogrinfo -so Nigeria_LGA.shp Nigeria_LGA" I am getting following result INFO: Open of
Nigeria_LGA.shp' using driver
ESRI Shapefile' successful. Layer name: Nigeria_LGA Geometry: Polygon Feature Count: 774 Extent: (2.668534, 4.273007) - (14.678816, 13.894419) Layer SRS WKT: GEOGCS["GCS_WGS_1984", DATUM["WGS_1984", SPHEROID["WGS_84",6378137.0,298.257223563]], PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]] Commented Dec 6, 2017 at 10:59 -
Nigeria has 3 zones in UTM projection WGS 84 datum: Zone 31N, 32N, and 33N. You need to choose the correct zone among the 3 zones and reporoject your data from Geographic WGS 84 to UTM Zone (31N OR 32N OR 33N) and (disable OTF). Right-click the layer in the table of content and go
Save as
and select the correct Zone in UTM projection WGS 84 datum. Commented Dec 6, 2017 at 11:08 -
after setting UTM projection WGS 84 datum: 33N then I am trying to divide polygon then new polygon created with the same size and it's default CRS WSG 84 changes, how it get changed? Commented Dec 6, 2017 at 13:35
-
First disable the OTF from
Project -> Project Properties -> CRS -> uncheck Enable 'On the Fly' CRS Tansfomation
. Load the projected UTM polygon into a new QGIS Project. Then use Polygon Divider as described in the answer. Commented Dec 6, 2017 at 13:41 -
I followed the same instruction as mentioned above still I am getting the same polygon with no values in attribute table, I don't know what's wrong I am doing :( Commented Dec 6, 2017 at 14:01
alternatively, you can reproject with Geopandas
import geopandas as gpd
gdf = gpd.read_file('WGS_84_file.shp')
gdf = gdf.to_crs({'init':'epsg:3395'}) #crs in metres, look up the epsg code for your case