crash in ExecuteIntersectionQuery in mapBox1_MouseUp

Topics: WinForms Controls
Oct 15, 2012 at 9:02 AM

Hello I am a newbie with sharpmap, it is really an amazing project.

I want to get info at a point in s57 map, the i use is a NOOA map from NY "US5NY1DM.000".

In the map i trap MouseUp event with the code below:

it crashes at   layer.DataSource.ExecuteIntersectionQuery(punkt, ds);

with the error Input string was not in a correct format.Couldn't store <Quality of data defined at a larger scale> in CATZOC Column.  Expected type is Int32.

  private void mapBox1_MouseUp(Point worldPos, MouseEventArgs imagePos)
        {
  //            DoTrueIntersectionQuery
           foreach (SharpMap.Layers.VectorLayer layer in map.Layers)
           {
               SharpMap.Data.FeatureDataSet ds = new SharpMap.Data.FeatureDataSet();
                if (!layer.DataSource.IsOpen)
                    layer.DataSource.Open();
                var p = mapBox1.Map.ImageToWorld(imagePos.Location);
                SharpMap.Geometries.Point punkt = mapBox1.Map.ImageToWorld(imagePos.Location);
             //  SharpMap.Geometries.Point punkt2 = new SharpMap.Geometries.Point(worldPos.GetBoundingBox);
             //   if (layer.LayerName == "LNDARE" || prov.LayerName == "LNDARE")
                System.Diagnostics.Debug.WriteLine(layer.LayerName);
//        if (layer.LayerName=="Layer_LNDARE")
//        {
        layer.DataSource.ExecuteIntersectionQuery(punkt, ds);
        layer.DataSource.Close();
            foreach (SharpMap.Data.FeatureDataRow feat in ds.Tables[0])
            {
                foreach (Object ob in feat.ItemArray)
                {
                    System.Diagnostics.Debug.WriteLine(ob.ToString());
                }

            }
//          }
           }
        }
    }

 

 

Regards Peder