Problem with GeoAPI

Aug 7, 2013 at 11:13 AM
Hi All,

I had the issue with running the sharpmap code with SQLserver2008 provider

"Cannot use GeometryServiceProvider without an assigned IGeometryServices class"

then I added the following code.

GeoAPI.GeometryServiceProvider.Instance = new NetTopologySuite.NtsGeometryServices();

The application crashes " Cannot load Geoapi 1.7.0 "

Could anyone help me with this scenario.

All Dlls referred to are 1.7.1 version.

Thank you in advance.

Aug 7, 2013 at 12:50 PM
If you're using any of the RC releases you'll need to add an Assembly redirect..

It should be fixed if you're using 1.0 Final though.

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="GeoAPI" publicKeyToken="a1a0da7def465678" culture="neutral" />
<bindingRedirect oldVersion="" newVersion="" />
Aug 7, 2013 at 1:06 PM
Thanks for the quick reply Petlof,

I am currently using 1.0 RC3. Will take the latest updated 1.0 final and try again.
Will update once I try the new ones.

Thanks again
Aug 8, 2013 at 8:53 AM
Hi PetLof,

I tried using the new 1.0 Final dlls and also tried using the runtime configuration.
But its still not working for me.

I am putting in some more info so that you can probably try helping me out with this.

Scenario :
I working with SQL Server 2008 and win forms on .NET 4

I tried integration sharpmap with the winform application thick client ( where all the dlls that querry the database are in the same project as of the Win app).
This works fine.

But now i want to shift the database logic to a wcf service which would basically return me a sqlserver2008(which is serializable) Object which can be attached to the
vector layer on the client winform application. But in this scenario I am facing this issue . Even after using 1.0 final and using Assembly redirect.

Hope this would give you a clear picture of how I am trying to create this application.

Code crashes here in wcf service while it works fine with with the thick client.

SqlServer2008 ShapeDataObject = new SqlServer2008(sqlConnectionString, sFunctionName, sColumnName, "", SqlServerSpatialObjectType.Geometry);

Aug 13, 2013 at 2:38 PM
I'm also still having this problem still in the designer. My code runs fine, but when I load the control in the designer I get the "Cannot use GeometryServiceProvider without an assigned IGeometryServices class" error even with an assembly redirect in place.

The weird thing is it only happens when the control is embedded in another control. E.g:

I have a custom control named WorldViewer that includes a Sharpmap mapbox. When I load the WorldViewer control in the designer it works fine and displays properly. I also have a form that uses the WorldViewer control in a docking window setup. When I load that main form in the designer, the window containing the WorldViewer doesn't display and gives me the IGeometryServices class error.

Aug 14, 2013 at 5:00 AM
We've added detection of then a Control is in designer mode and does not initialize GeoAPI then... However, this maybe failes if the control is embedded in another control. We'll have to check this..

Thanks for the Report
Aug 14, 2013 at 5:01 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.