Quantcast
Channel: DotSpatial
Viewing all 3973 articles
Browse latest View live

Created Unassigned: Polygon with hole [63600]

$
0
0
Hello
I am sorry for my English
I have short fragment of code

```
static void Main(string[] args)
{
FeatureSet fs = new FeatureSet(FeatureType.Polygon);
fs.Projection = KnownCoordinateSystems.Geographic.World.WGS1984;
List<Coordinate> coorBig = new List<Coordinate> { new Coordinate(0, 0), new Coordinate(0, 100), new Coordinate(100, 100), new Coordinate(100, 0) };
List<Coordinate> coordCenter = new List<Coordinate> { new Coordinate(25, 25), new Coordinate(25, 75), new Coordinate(75, 75), new Coordinate(75, 25) };

LinearRing lr1 = new LinearRing(coorBig);
LinearRing[] lr2 = { new LinearRing(coordCenter) };
Polygon pgHole = new Polygon(lr1, lr2);

fs.AddFeature(pgHole);
fs.SaveAs("C:\\Temp\\testD.shp", true);
}
```

When I open this shape file, I see multipolygon instead polygon this hole. Could somebody help me, what I did wrong? Thanks for your help.

New Post: Developer Getting Started Guide

$
0
0
Hello,
I've developed some GIS tools in VB.NET using earlier versions of dotspatial. What never worked was using GDAL.
Now again I want to develop a very simple tool using DotSpatial 1.7. So I thought it might be best to follow the Developer Getting Started Guide. But I'm facing some trouble:

1.2 Exercise 1: Assemble a Map Project:
"Once we finish linking the controls together a “Tools” tab will be added next to the “Legend” tab." --> The “Tools” tab never appears.
The menu bar with basic mapping functions appears. But first layers added via the Button of the menu bar don't appear in the map nor the legend. This works after changing the build setting to .NET 4.0 Client Profile.
Adding a custom toolbar destroys the layout of the form and there's no option to locate it relatively to the automatically added menu bar...

1.10.1 GDAL:
When Spatial Header Control and Spatial Status Strip are added to the project created following 1.2 exercise, the menu bar doesn't appear any more. Unfortunately GDAL doesn't work either. I tried it again and again.
Same problem here: where can I add a custom toolbar? When I place it above the Spatial Dock Manager, Legend and Map appear twice after compiling.

Has someone else faced these problems and maybe has a workaround? Is this maybe caused by using VB?
Is there a way of using GDAL without Spatial Dock Manager, Spatial Header Control, Spatial Status Strip? I never needed those nor the automatically generated menu bar in my former tools.

Thanks, Claudia

New Post: Override Ribbon menu

$
0
0
I've been using the Ribbon plugin and loaded the standard menu bar which comes with different buttons like Zoom In/Out, Select, etc. I would like to change what happens when one of these buttons is clicked. How can this be done? I have been trying to find and get access to the item that the button corresponds to, but have had no luck yet. Thanks

New Comment on "ProjectionTestResults"

$
0
0
Do these Tests still stand? What is the date of the tests? If improvement have been made since these tests were carried out, could we see more up-to-date results? I am concerned because I would like to use DotSpatial.Projection in place of Proj+ .. and specifically for the British National Grid. I am currently converting GPS coordinates to Northing and Easting using the Ordnance Survey provided GIQ60... Failed BritishNationalGridOSGB36 Assert.Fail failed. The longitude was off by 152.504282853587 decimal degrees from proj4 That seems like a large discrepancy... Regards Oliver

New Comment on "UnionShapesCS"

$
0
0
To union two or more different shapefiles... perhaps it is possible to open the first Shapefile into the FeatureSet and then Add the other shapefile into the same FeatureSet.. then run fs.UnionShapes... ?

New Post: Developer Getting Started Guide

$
0
0
Hi Claudia,

here is an old discussion where GDAL usage was explained : https://dotspatial.codeplex.com/workitem/23782

however I guess that latest Dotspatial does not need to follow the steps I listed in one of the posts to that workitem. The only thing I do now is to add the GDAL folder into the plugins directory and call the load extensions at app startup.


I fixed that a long ago so maybe I don't remember everything well.

Furthermore, to get rid of default dock header and status strip you need to create a dummy header control class yourself and use it.

Here are the sources of mine (basically I created a c# library of classes named DummyHeaderControl and added these three classes):

file: DummyHeaderControl.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotSpatial.Controls.Header;
using System.ComponentModel.Composition;

namespace DummyHeaderControl
{
    [Export(typeof(IHeaderControl))]
    public class DummyHeaderControl : IHeaderControl
    {
        public DropDownActionItem MapServiceDropDown { get; private set; }
        public void Add(HeaderItem item)
        {
            switch (item.Key)
            {
                case "kServiceDropDown":
                    {
                        MapServiceDropDown = item as DropDownActionItem;
                    }
                    break;
            }
        }

        public void Remove(string key)
        {

        }

        public void RemoveAll()
        {

        }

        public void SelectRoot(string key)
        {

        }

        public event EventHandler<RootItemEventArgs> RootItemSelected;
    }
}
file: DummyDockManager.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotSpatial.Controls.Header;
using DotSpatial.Controls.Docking;
using System.ComponentModel.Composition;

namespace DummyHeaderControl
{
    [Export(typeof(IDockManager))]
    public class DummyDockManager : IDockManager
    {

        public void Add(DockablePanel item)
        {

        }

        public void ResetLayout()
        {
        
        }

        public void Remove(string key)
        {

        }

        public void SelectPanel(string key)
        {

        }

        public void HidePanel(string key)
        {

        }

        public void ShowPanel(string key)
        {

        }

        //public interface ActivePanelChanged
        //{
        //}

        public event EventHandler<DockablePanelEventArgs> ActivePanelChanged;
        public event EventHandler<DockablePanelEventArgs> PanelClosed;
        public event EventHandler<DockablePanelEventArgs> PanelAdded;
        public event EventHandler<DockablePanelEventArgs> PanelRemoved;
        public event EventHandler<DockablePanelEventArgs> PanelHidden;



        //public void RemoveAll()
        //{

        //}

        //public void SelectRoot(string key)
        //{

        //}

        //public event EventHandler<RootItemEventArgs> RootItemSelected;
    }

}
file: DummyStatusControl.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using DotSpatial.Data;
using DotSpatial.Controls.Extensions;
using DotSpatial.Controls.Header;

namespace DummyHeaderControl
{

     /// <summary>
        /// Used to display status information.
        /// </summary>
        [InheritedExport]
        public interface IStatusControl : IProgressHandler
        {
            /// <summary>
            /// Adds the specified panel.
            /// </summary>
            /// <param name="panel">The panel.</param>
            void Add(StatusPanel panel);

            /// <summary>
            /// Removes the specified panel.
            /// </summary>
            /// <param name="panel">The panel.</param>
            void Remove(StatusPanel panel);
        }
    
}
you can compile them and set reference to the resulting dll in your VB project.

Then in your application load you need to add the following code to use them
        Me.AppManager1.HeaderControl = New DummyHeaderControl.DummyHeaderControl
Hope this solves some of your problems
if you need already compiled dummyheadercontrol tell me and I will send it via WETRANSFER
Oscar

New Post: Add hole to a polygon programmatically

$
0
0
How do you add a hole to a polygon? I have tried the code below but you are not allowed to modify the Holes collection (runtime exception)
var coordinates = new List<Coordinate>() 
            {
                new Coordinate(1375930, 6269230),
                new Coordinate(1376248, 6269230),
                new Coordinate(1376248, 6268860),
                new Coordinate(1375930, 6268860)
            };
            var feature = new Feature(FeatureType.Polygon, coordinates);

            var hole = new LinearRing(new List<Coordinate>()
            {
                new Coordinate(1376000, 6269130),
                new Coordinate(1376100, 6269130),
                new Coordinate(1376100, 6268960),
                new Coordinate(1376000, 6268960)
            });


            ((IBasicPolygon)feature.BasicGeometry).Holes.Add(hole);

New Post: Add hole to a polygon programmatically

$
0
0
OK, I figured out a solution:
var outerRing = new LinearRing(new List<Coordinate>()
            {
                new Coordinate(1375930, 6269230),
                new Coordinate(1376248, 6269230),
                new Coordinate(1376248, 6268860),
                new Coordinate(1375930, 6268860)
            });

            var hole = new LinearRing(new List<Coordinate>()
            {
                new Coordinate(1376000, 6269130),
                new Coordinate(1376100, 6269130),
                new Coordinate(1376100, 6268960),
                new Coordinate(1376000, 6268960)
            });

            var geomFactory = new GeometryFactory();
            var poly =  geomFactory.CreatePolygon(outerRing, new ILinearRing[]{hole});

            var feature = new Feature(poly);

New Post: is there an equivalent for SharpMap's VectorLayer.MaxVisible ?

$
0
0
In Sharpmap, when you zoom below the layer's MaxVisible, the layer is visible, when you zoom-out above MaxVisible, the layer is invisible. this is handled __automatically__ by the sharpmap framework.

       Is there an equivalent for it, in dot spatial, to make AUTOMATICALLY the map layers visible/invisible  depending on how much you are zooming in or out?

New Post: Converting GPS to British National Grid - OSGB36 Northing/Easting

$
0
0
Hi...

I am trying to output the northing and easting in the British National Grid for objects mapped via GPS... My code is :
            Dim xy(1) As Double
            xy(0) = latitude
            xy(1) = longitude
            Dim z(0) As Double
            z(0) = ellipseHeight
            Dim pStart As ProjectionInfo = KnownCoordinateSystems.Geographic.Europe.ETRS1989
            Dim pEnd As ProjectionInfo = KnownCoordinateSystems.Projected.NationalGrids.BritishNationalGridOSGB36
 
            Reproject.ReprojectPoints(xy, z, pStart, pEnd, 0, 1)
I also tried WGS84 and I was getting a NaN in xy(0) and xy(1) ...

Has anyone tried converting to OSGB36? Currently I am using the GIQ60 Grid In Quest dll and dat file - which doesn't seem to be supported these days...

Thanks

Oliver

New Post: Some advice on adding open streetmap to my project

$
0
0
Hi,

I am using the dotspatial.plugins.brutilelayer from Felix and it works perfect with my application.

I am looking for a way to configure the grid lines displayed between the Open Street map tiles.
Can I configure the color or hide the grid?

I call the layer this way
Dim _btLayer As DotSpatial.Plugins.BruTileLayer.BruTileLayer
_btLayer = DotSpatial.Plugins.BruTileLayer.BruTileLayer.CreateKnownLayer(BruTile.Predefined.KnownTileSource.OpenStreetMap, "")
Thank you

Thomas

New Post: Send NmeaInterpreter my own nmea string

$
0
0
Hello,
I'm using DotSpatial to get NMEA strings, I want to use it in two ways. 1st, I have connected a gps device to my rs232 interface, using the NmeaInterpreter, this works well. 2nd, I build this string in another application and want to split this string with the NmeaInterpreter, but I cound not manage this. How is the best way to feed the NmeaInterpreter with my own NMEA-String?

New Post: Some advice on adding open streetmap to my project

$
0
0
There currently is not. I've added the orange frames around the tiles for debugging purposes.
[MethodImpl(MethodImplOptions.Synchronized)]
privatevoid DrawTile(MapArgs args, TileInfo info, Resolution resolution, byte[] buffer, TileReprojector tr = null)
{
    /*
     * Some code
     */if (outBitmap != bitmap) outBitmap.Dispose();
    // new:if (FrameTile)
    {
        var pen = FramePen ?? Pens.Orange;
        args.Device.DrawRectangle(pen, rect);    
    }
}

///<summary>/// Gets or sets a value indicating whether to frame the tile or not///</summary>bool FrameTile { get; set; }

///<summary>/// Gets or sets a value indicating the Pen to frame the tile with///</summary>
System.Drawing.Pen FramePen { get; set; }

New Post: Parallel implementation of DotSpatial.Symbology raster opperations.

$
0
0
Hi there,

I'd noticed that some raster operations could take a wee while to get through in my application, namely hillshades and coloring. I did a few minor tweaks to allow such methods to run in parallel and really get the most from your CPU. Hopefully it's of some use.

The code changes are essentially using a flat array of indexes and a .Net parallel for loop, like so:
            int I = raster.NumRows;  // get I
            int J = raster.NumColumns; // get J
            int N = I*J; // N total cells to work on
            
            bool calculating = true;  //update loop will run while this is true
            int nDone = 0; // allows progressbar to get some information

            Task parallelThing = new Task(() =>
            {
                calculating = true;
                
                // equivalent of for(int n = 0; n < N; n++)
                Parallel.For(0, N, n =>
                {              
                    int j = n % J; // Get's the column index
                    int i = (n - j) / J; // Gets the row index

                    //you can now get values as you normally would e.g:
                    //var value = getValue(i, j); 

                    nDone++; 
                });
               calculating = false;
            });

            parallelThing.Start();
            while (calculating) pm.CurrentValue = nDone; 
            System.Threading.Tasks.Task.WaitAll(parallelThing); 
DotSpatial.Symbology.DLL - to work with dotspatial 1.7
https://www.dropbox.com/s/h7v9knv1z9zvtpx/DotSpatial.Symbology.dll?dl=0

Desktop Raster Ext
https://www.dropbox.com/s/1mxq8df8nu4wppd/DesktopRasterExt.cs?dl=0

Raster Symboliser -- commented out parallel code but it can easily be changed
https://www.dropbox.com/s/x19z1ajzerdmblq/RasterSymbolizer.cs?dl=0

Source code checked in, #ce4bd944dcb6a2c0507aaf2088c754dcd84b4465

$
0
0
- Allow zooming in when MapFunctionZoomOut has zoomed out to MaxExtent - Allow zooming and paning by scroll wheel when using ShapeEditors AddShapeFunction or MoveVertexFunction

New Post: IndexMode

$
0
0
Somebody more than me who is not clear about this?

New Post: is there an equivalent for SharpMap's VectorLayer.MaxVisible ?

$
0
0
you should look at DynamicVisibilityMode

Oscar

Source code checked in, #2759c0b37ccb2439cec3234c81d9c2ca52c6b6bf

Released: DotSpatial 1.8 (Sep 15, 2015)

$
0
0
DotSpatial 1.8 release notes:
  • Simplified DotSpatial Controls Toolbox
  • Various minor bugfixes
  • Increased support for German
  • Branches other than Trunk are obsolete (please do not update them)

Updated Release: DotSpatial 1.8 (Sep 15, 2015)

$
0
0
DotSpatial 1.8 release notes:
  • Simplified DotSpatial Controls Toolbox
  • Various minor bugfixes
  • Increased support for German
  • Branches other than Trunk are obsolete (please do not update them)
Viewing all 3973 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>