ThinkGeo.com    |     Documentation    |     Premium Support

Can`t create the grid polygon layers

Hello guys,

I can`t create the grid polygon layers, using the “Split Polygon Based On Grid” with files like “osm_ocean_polygons_simplified_1.shp”.

In the output file, I always get a result like a checkerboard.

Could you help?

input


output

Thanks Alexander,
Could you attach the shape file and the code you are using. This could help use re-produce the issue.

Thanks

Frank

Hello Frank,

I attached the archive. Could you check the described behavior?

Best regards,

Aleksandr

send.zip (3.9 MB)

Thanks Aleksandr,
I found the reason for this issue. The shape file you provide is 3857 projection. You need convert it to 4326 then process it. So you need add one line around line 34


ShapeFileFeatureSource.BuildIndexFile(file, BuildIndexMode.Rebuild);
ShapeFileFeatureSource shapeFile = new ShapeFileFeatureSource(file, ShapeFileReadWriteMode.ReadOnly);
shapeFile.Projection = new Proj4Projection(3857, 4326);
shapeFile.Open();

Then it works. The result will looks like

Here is the full source code.
SplitPolygons.cs (8.2 KB)

Thanks

Frank

1 Like

Thanks, Frank. :slightly_smiling_face:

No problem Alexander,
Go ahead let us know if you have any more question.

Thanks

Frank