ThinkGeo.com    |     Documentation    |     Premium Support

Runtime error: The input double value is out of range (Parameter maxX) in MapSuiteCore.dll

Hi ThinkGeo,

We use latest version 9 of Map Suite Desktop Edition Winforms Map-Control to replace ESRI MapObject-2 in our applications. Most things work well. But recently we have problems with some shapefiles. These files work well in ESRI MapObject but crash ThinkGeo Winforms Map-Control when call Refresh method. Here is error message:

An unhandled exception of type ‘System.ArgumentOutOfRangeException’ occurred in MapSuiteCore.dll
Additional information: The input double value is out of range.\r\nParameter name: maxX

I attached one of problem shapefiles. Would you help in fixing this problem?

Thank you very much,

Mengbo

shapefile_maxX_error.zip (240.2 KB)

Hi Mengbo,

You should forget build index for the shape file and use in correct map unit.

Please try the code as below, which works well for your shape file:

  {
        winformsMap1.MapUnit = GeographyUnit.Meter;
        winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);

        ShapeFileFeatureLayer.BuildIndexFile("D:\\8322\\FM_FAIRWAY.shp", BuildIndexMode.DoNotRebuild);
        ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer("D:\\8322\\FM_FAIRWAY.shp");            
        worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
        worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

        LayerOverlay staticOverlay = new LayerOverlay();
        staticOverlay.Layers.Add("WorldLayer", worldLayer);

        winformsMap1.Overlays.Add("WorldOverlay", staticOverlay);

        worldLayer.Open();
        winformsMap1.CurrentExtent = worldLayer.GetBoundingBox();
        worldLayer.Close();
        winformsMap1.Refresh();
    }

Regards,

Don

Hi Don,

Yes, your code works for my problem shapefiles. You are great!

Actually my application does not build index files for these shapefiles. My application sets ShapeFileFeatureLayer.RequireIndex = false and works well with many other shapefiles, except these problems shapefiles.

When I put ShapeFileFeatureLayer.RequireIndex = false in your code, your code gets the same error when calls Refresh method.

Do you have ideas how make my problem shapefiles work without index files?

Thank you so much for your help,

Mengbo

Hi Mengbo,

That’s because your test data contains 38 shapes, the last two shapes are invalid, all the shapes before that is valid MutiPolygon, but the last two shapes cannot pass the validation.

If you want to make the shape file works with ShapeFileFeatureLayer.RequireIndex = false, please remove the two shapes.

Or build index for the shape and open the shape file with index file, which can also improve the performance.

Regards,

Don

Hi Don,

Your suggestion helps a lot. I am using your method to work with problem shapefiles, because we cannot control our users use problem shapefiles. Just have a curious question:

Does ShapeFileFeatureLayer.BuildIndexFile() method fixes the invalid shapes? Or it uses some methods to help Map-Control ignores invalid shapes when refreshing?

Thank you so much for all your helps!

Mengbo

Hi Mengbo,

I think the index just help to ignore invalid shapes, it cannot fix it. If your shape file is uploaded by your user, you can call BuildIndexFile after it upload succeed, and choose DoNotRebuild to make sure this process only works once for the same shape file.

Regards,

Don