This project has moved and is read-only. For the latest updates, please go here.

Tiled map with HatchBrush-filled polygon data

Topics: General Topics, SharpMap v0.9 / v1.x
Nov 10, 2010 at 2:29 PM

Hi folks,

I’ve created a map which I am viewing in OpenLayers. I am tiling the map to 256px tiles, and currently displaying some polygon data as part of the map. The problem I am having is that the polygons are being styled with a HatchBrush and the edges of each tile look really odd where two bits of the polygon meet. I’ve uploaded an image of what I mean: You can see a funny squiggly line where the tiles meet and the fills don’t match up.

I’m using SharpMap.Data.Providers.SqlServer2008 for the data provider and have tried using the BufferedDataProviderProxy to see if it was a problem with not all the data being fetched for the polygons, but that didn’t seem to help.

Is there any way to ensure that all of the tiles use the same origin for their fills so the patterns meet up around the edges? As it is it looks really silly and wrong :(



Nov 10, 2010 at 6:35 PM

Hi dylan,

you might want to try setting System.Drawing.Graphics' RenderingOrigin property.

Hth FObermaier

Nov 10, 2010 at 6:42 PM

Thanks. How would I go about setting that property for a layer or map? I can’t seem to find any properties of the map or layer that would match.

Nov 10, 2010 at 9:38 PM
Edited Nov 11, 2010 at 9:33 AM

It is not there yet.

Since it (only?) relates to Texture- and/or Hatchbrushes I would add a property


public Point RenderingOrigion { get; set; }


to VecorStyle and assing that to the graphics object in the Render function of the VectorLayer class.

You might also get rid of the small glitches if you adjust your tile size to a multiple of the horizontal distance between the hatch lines. If this distance is e.g. 5 pixel and RenderingOrigin is (0, 0) you will get the offset at the tile edge if they are 256 px wide. If you try 255 px they should be gone.

Another idea is to set the RenderingOrigin to the whole maps center in image coordinates.

Hth FObermaier