Page 1 of 1

Rendering .shp file with ITiledProvider

Posted: Fri Sep 16, 2016 8:26 am
by KasperD
Hello all,

One of our customers who's experimenting with rendering .shp files in the .NET Mapcontrol (and is also the customer from issue http://xserver.ptvgroup.com/forum/viewt ... f=14&t=383 ) has the following issue:

The customer used the example from the .NET Mapcontrol documentation "Show a Shape File Content - Using a tiled provider" to display a custom .shp file in the map. However, the areas were drawn at different (wrong locations), so the customer began to troubleshoot by copying the code and needed sources and resources into a blank project.
His findings:

- When using the SharpMap and ProjNet dll from 'our' xServer .NET directory, all is well and the areas are drawn correctly
- However, the customer uses NuGet to obtain the correct packages, and this is also his preferred method. When adding the SharpMap package, the problem appears. To get it working again, the customer had to change some 'using' statements; apparently this has changed in the newer version of the SharpMap package. See the 16.patch file; - has been removed, + has been added. (This is a patch file for Mercurial in which you can see the differences between 'our' DLL's and the DLL's from NuGet, mostly "using" statements).

What stands out is that the customer has to use both GeoAPI.CoordinateSystems.Transformations and ProjNet.CoordinateSystems.Transformations to be able to compile the project again. He thinks this is why the coordinate transformations go wrong.

Customer is using Visual Studio 2012. I've combined all the needed files into this download link: https://ptvbox.ptvgroup.com/index.php/s/FNCyX9NlLK86jwg

Could you have a look and see what might be causing the coordinate shift when using NuGet?
Thanks in advance,

Re: Rendering .shp file with ITiledProvider

Posted: Fri Sep 16, 2016 12:22 pm
by f.gailfuß

Re: Rendering .shp file with ITiledProvider

Posted: Mon Sep 19, 2016 7:50 am
by f.gailfuß
SharpMap 1.1 requires some additional references and uses GeoAPI.Geometries.Envolope instead of SharpMap.Geometries.BoundingBox to express rectangles and bounding boxes. The latter change is crucial as ShapMap changes the order of the coordinates in some places - once that is fixed, the demo initially attached to http://xserver.ptvgroup.com/forum/viewt ... f=14&t=383 runs well with SharpMap 1.1 and your logicx.shp Shapefile. Please find an updated demo attached. We'll check if we incorporate SharpMap 1.1 into DemoCenter with the next release.

Re: Rendering .shp file with ITiledProvider

Posted: Mon Sep 19, 2016 7:54 am
by KasperD
Frank,

Thanks for the reply and the research work. I'll forward the information to the customer.