Page 1 of 1

.NET Mapcontrol with custom .shp file

Posted: Wed Sep 14, 2016 10:47 am
by KasperD
Hello everbody,

One of our customers who is more experienced with the .NET Mapcontrol (Logicx) is trying to implement a .shp file with specific geographic data into the Mapcontrol for display purposes. The original .shp file works well, however it contains too much information for their use-case and has a negative influence on the zooming/panning speed. Therefore we used QGIS to extract the needed data from this .shp file (4ppc.zip, see attached) into a new custom .shp file (logicx.zip, see attached), sufficient for their use-case.

However, when using the "Show a Shape File Content" from the .NET Mapcontrol Documentation and trying to display the custom "logicx" .shp file, an error message appears (see attached).
the variable sharpMap isn't null, the exception appears when using the GetMap method in the dll.

Can you reproduce this locally, and possibly find out if it has to do with our custom .shp file? Or is there another way to get our custom .shp file working?

thanks in advance,

Re: .NET Mapcontrol with custom .shp file

Posted: Fri Sep 16, 2016 12:18 pm
by f.gailfuß
I can confirm that SharpMap, the 3rd party component we're using for demoing the Shapefile access, seems to have a problem with your logicx.shp Shapefile. SharpMap fails while running a query against your data ("ExecuteIntersectionQuery"). I cannot tell if this is a problem of SharpMap or the Shapefile itself. You can force rendering by catching SharpMap's exceptions; I can see one area being rendered but I cannot tell if the output is complete (see my sample attached). There's a newer version of SharpMap available. Unfortunately this seems to have a coordinate transformation problem in our context so that this version is currently not an option.

You reported that your initial problem with the full set of data was that it has a negative influence on the zooming/panning speed. As our Shapefile implementation has just been provided for demo purposes, it has room for optimizations. Currently each tile being rendered requires a dedicated SharpMap; thus, Shapefiles are intialized repeatedly with every tile being requested. We tried to optimize this behavior using cached SharpMap instances. Hopefully this allows you to use your initial set of data working around the problem with logicx.shp.

We'll investigate into the problem with the newer SharpMap version separately; not sure if solves your problem and if we can provide a quick solution for that.

Re: .NET Mapcontrol with custom .shp file

Posted: Fri Sep 16, 2016 12:30 pm
by KasperD
Frank,

Thanks for your reply. As the customer only needed 2 specific postal code area's, together with the fact that in the initial implementation rendering the entire .shp file had a negative impact on performance, we've extracted the needed postal code areas using QGIS 2.14
Not sure whether this manual extraction is causing the error messages, but i've checked your project and only part of the 'extracted' shp file is rendered, so it might correlate. When uploading the .shp file into QGIS, the areas needed are drawn correctly; see attached screenshot below. I'll look into extracted the needed postal code data with QGIS again and will use your project to render it.

If you could keep me updated on the problem with the newer SharpMap version that would be great, as that would most likely solve the issue completely.

Edit: i've made a new extract from QGIS and this seems to be working correctly in the project you've send me. I'll send it to the customer and will ask him to test for himself.

Re: .NET Mapcontrol with custom .shp file

Posted: Mon Sep 19, 2016 7:51 am
by f.gailfuß
Regarding the newer SharpMap version, please find an answer and updated demo in http://xserver.ptvgroup.com/forum/viewt ... f=14&t=384.