MW5 and Spatialite

Sep 8, 2016 at 4:39 PM
Edited Sep 9, 2016 at 6:49 AM
Hi!

Loading 20MB shapefile is quick and well done in MW5. But loading this same amount of 20MB with Data Repository and connecting to Spatialite database shows only in the legend as layer with all data in the table view but nothing appear in the map!

Who knows where is the problem?

Thanks for help and regards, Vojko
Coordinator
Sep 27, 2016 at 1:13 PM
Can you enable the debug plug-in and show us its contents?

Thanks,

Paul
Sep 28, 2016 at 12:06 PM
Edited Sep 28, 2016 at 2:56 PM
The code bellow works fine for all layers in spatialite database. Only when I try to run layer with land
parcels (polygons) with about 20 MB the error occurs.
Also when loading this same layer with MW5 repository leads to the same error. The legend and table for that layer appears in
second but map shows no parcels. The table shows no parcels.

If my SQL statement for the same layer is: "Select .... from PARCELS where ID = "1070" then everything is fine.

As I wrote you while loading this same layer in DotSpatial environment it takes only a second to shows layer in map.

Could you please see what the problem might be.

Thanks and regards, Vojko
// MW5 code 
private void button1_Click(object sender, EventArgs e)
    {
       string layerNameOrQuery = null;
   string fn = @"c:\db\geom.sqlite";

        using (var ds = new VectorDatasource())
        {
            bool result = ds.Open(fn);
            if (!result)
            {
                MessageBox.Show(" no connection : " + result);
                Cursor.Current = Cursors.Default;
            }
            else
            {
                var layer = ds.RunQuery(layerNameOrQuery);
                if (layer == null)
                {
               int li = _context.Layers.Add(layer);
        }
    }

      _context.Layers[li].Name = lay_name + "_IZBOR";
              _context.Map.ZoomToLayer(li);
              _context.Map.Redraw();
              _context.Legend.Redraw();
              _context.Layers[li].FeatureSet.SaveAs(fshp);

                    _context.Layers.MoveLayer(li, 1, 0);
                    _context.Map.Legend.Redraw();
    }
  }
Oct 3, 2016 at 8:36 AM
The code from my previous post works fine for all layers in spatialite database.
Except two problems now left which I can not handle:
  • loading 20 MB polygons only shows in the legend and map is empty
  • strange behavior when:
Have these layers wit positions 0, 1 and 2 in the map and in the legend:
  1. first delete one layer with position 0 or 1
  2. adding new one
  3. try to change name, color, ... for new layer:

    // layer from SQL
    int li = _context.Layers.Add(layer);
      _context.Layers[li].Name = "NEW_NAME";
          var plg = _context.Layers[li].FeatureSet.Style.Fill;
          plg.Color = Color.Yellow;
    
          _context.Map.Redraw();
          _context.Legend.Redraw();
          _context.Map.Legend.Redraw();
    
    These changes occured on wrong layer in the legend and then reflect in the map also.
    If delete layer with position 2 loading new layer is fine.
Could you please see what the problem might be.

Thanks and regards, Vojko