Topics: SharpMap v2.0
Sep 2, 2010 at 10:21 PM

I got the source from SVN on GoogleCode yesterday.

I have references to GeoAPI, ProjNet, Proj4Utility and serveral others.

I've initialized SridMap:


SridMap.DefaultInstance = new SridMap( new[] { new SridProj4Strategy( 0, new GeometryServices().CoordinateSystemFactory ) } );


But when I try to get a GeometryFactory for a defined coordinatesystem

_GeomFac = _GeomServices["EPSG:4326"];

_GeomFac.SpatialReference is null.

So I try:

_GeomFac.SpatialReference = coordSysFac.CreateFromWkt( "OGC_WKT from" );

_GeomFac.SpatialReference is still null.

So I try:

IEnumerable<Proj4Utility.Proj4Reader.Proj4SpatialRefSys> srs= Proj4Utility.Proj4Reader.GetSRIDs();

foreach( Proj4Utility.Proj4Reader.Proj4SpatialRefSys SR in srs ) {
if( cs.Epsg == SR.Srid ) {
wkt = SR.SrText;

_GeomFac.SpatialReference = coordSysFac.CreateFromWkt( wkt );

But _GeomFac.SpatialReference is still null.

Any ideas what I'm doing wrong?


Sep 3, 2010 at 9:55 AM

Hello bergw,

I added this class to SharpMap.Tests project,

using NUnit.Framework;
using SharpMap.Utilities.SridUtility;

namespace SharpMap.Tests
    public class GeometryServicesTests
        public void Test1()
            Utilities.GeometryServices gs = new Utilities.GeometryServices();
            SridMap.DefaultInstance = new SridMap(new[] { new SridProj4Strategy(0, gs.CoordinateSystemFactory)});
            var gf = gs["EPSG:4326"];
            Assert.AreEqual("EPSG:4326", gf.Srid);

added references to SharpMap.Utility and NUnit.Framework, and I think it works fine.

hth FObermaier

Sep 5, 2010 at 12:36 PM


Hello FObermaier,

thanks for your time.

Very strange, because now it is working although I haven't changed anything in my code.