ThinkGeo.com    |     Documentation    |     Premium Support

Cannot get rid of the grid lines after splitting shapefile into grid

I am trying to optimize map rendering performance by splitting a shapefile with large complex polygons into a grid.

I am using your sample implementation that I found here: http://wiki.thinkgeo.com/wiki/map_suite_services_edition_spatial_functions_samples#split_polygon_based_on_grid

After running the polygon splitter, two new shapefiles are created: AreaSplit and LineSplit. When I load the AreaSplit shapefile into the map, it works great, except that I can see all the new lines where the polygons have been split.

I want to get rid of these lines, so that the shapefile appears to the user as if it has not been split into a grid.

I follow this video guide: http://download.thinkgeo.com/Videos/Wiki/IncreasingPolygonPerformance.wmv
where I learn I can set the Outline color of the AreaStyle to transparent, and the grid lines should become invisible (05:10 into the video).

Unfortunately, this leaves a thin gap between the polygons, through which the underlying layer is visible - in effect the grid lines are still visible. This does not happen in the video.

I have tried everything I can think of to get rid of this gap:
Setting OutlinePen to null,
Setting OutlinePen.Width to 0,
etc.
Nothing seems to help.

Can you point me in the right direction?

Hi Jonas,

Thanks for your detail information, I tried to reproduce that with our cntry02 shape file but it looks i failed complete that, I even cannot split the data succeed.

If possible could you please upload the modified sample with data so I can quickly reproduce it?

And do you have some special requirement for render that just like you need modify the style frequently? Because I think open tile cache can make the performance get better just like split them.

Regards,

Don

I had to make a little change to the sample to make it work.

In the SplitPolygons.cs code behind, these lines causes the exception:

if (areaIntersection != null)
{
	Feature newFeature = new Feature(areaIntersection);
	newFeature.ColumnValues.Add("RECID", feature.ColumnValues["RECID"].ToString());
	targetAreaShapeFile.AddFeature(newFeature);
}
if (lineIntersection != null)
{
	Feature newFeature = new Feature(lineIntersection);
	newFeature.ColumnValues.Add("RECID", feature.ColumnValues["RECID"].ToString());
	targetLineShapeFile.AddFeature(newFeature);
}

Add a check like this:

if (areaIntersection != null)
{
	Feature newFeature = new Feature(areaIntersection);
	if (feature.ColumnValues.Count > 0)
	{
		newFeature.ColumnValues.Add("RECID", feature.ColumnValues["RECID"].ToString());
	}
	targetAreaShapeFile.AddFeature(newFeature);
}
if (lineIntersection != null)
{
	Feature newFeature = new Feature(lineIntersection);
	if (feature.ColumnValues.Count > 0)
	{
		newFeature.ColumnValues.Add("RECID", feature.ColumnValues["RECID"].ToString());
	}
	targetLineShapeFile.AddFeature(newFeature);
}

Then it should run fine.

I have tried with the countries02.shp from the SampleData folder and it seems ok.

Jonas

Hi Jonas,

Thanks for your share!

That’s helpful to me and I think it also will be helpful if someone else met the same issue.

Regards,

Don

So… back to my original question, how do I get rid of those gaps?

Hi Jonas,

Please just set the style of Outline Color equal to the style of fill color, which will works just like my screen capture as below:

Regards,

Don