How to construct SharpMap.Map class instance? (IGeometryFactory parameter)

Topics: SharpMap v2.0
Jan 20, 2008 at 12:54 AM
Edited Jan 20, 2008 at 12:55 AM
Hello, I just checked out code from

Early I used v0.9 and hoped that v2 (even beta) will give me us higher rendering speed. Anyway I tried to use new version.

In v0.9 I would code:

private SharpMap.Map _mapObject = new SharpMap.Map();
// load layers here
// attach map object to map box control
_mapBox.Map = _mapObject;

But in v2 I wonder how to create Map class instance because in all of 2 constructors available there is IGeometryFactory parameter.

namespace SharpMap
public class Map : INotifyPropertyChanged, IDisposable
public Map(IGeometryFactory geoFactory)
public Map(String title, IGeometryFactory geoFactory)

If I pass null - I will receive exception from engine (not during Map class instance construction but later in other engine's code): for example in ShapeFileHeader.parseHeader(BinaryReader reader) method because geoFactory is null

ICoordinate min = _geoFactory.CoordinateFactory.Create(xMin, yMin);
ICoordinate max = _geoFactory.CoordinateFactory.Create(xMax, yMax);

I far as I understood many people are already using v2 so that I hope to receive an advice of how to init Map class object.

Jan 20, 2008 at 11:48 AM
Edited Jan 20, 2008 at 11:55 AM
@ Loobnin I think you will do better with v2 beta 1 as the newer stuff will throw NotImplemented in quite a few areas. A lot is changing between the betas..

if you want to go with the most current code you can use an IGeometryFactory implementation from NetTopologySuite

GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory<TCoordinate> (use BufferedCoordinate2D as TCoordinate)

The constructor for this requires an implementation of ICoordinateSequenceFactory see : SharpMap.Coordinates.BufferedCoordinateSequenceFactory<BufferedCoordinate2D>
however most of it will throw NotImplemented at present.
(Alternatively you can implement your own ICoordinate2D and associated factories)

All this is likely to be rearranged a bit in the near future though.. jd
Jan 20, 2008 at 2:19 PM
I've just followed instructions in "How to build v2" page and checked out source from google.

Can you help me - where go get Beta 1 source code?
Jan 20, 2008 at 3:34 PM
Edited Jan 20, 2008 at 3:39 PM
@loobnin :