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

New Post: M Values for points or lines

$
0
0
Ok. I'm not sure I understand what you're doing here:
    Dim lineArray As New List(Of Coordinate)
    Dim lineGeometry As LineString = New LineString(lineArray) // you create an empty linestring geometry
    Dim lineFeature As DotSpatial.Data.IFeature = lineF.AddFeature(lineGeometry) //you create a feature with this empty geometry
    lineFeature.Coordinates.Add(New Coordinate(coords(0).X, coords(0).Y, coords(0).Z, coords(0).M)) //you add your first coordinate to this feature

    Dim existingFeature As DotSpatial.Data.IFeature = lineF.Features(lineF.Features.Count - 1) //you get the last feature in lineF, but you already have it in lineFeature 

    For i = 0 To coords.Count - 1
     existingFeature.Coordinates.Add(New Coordinate(coords(i).X, coords(i).Y, coords(i).Z, coords(i).M)) //you add all your coordinates to existingFeature, but now it contains the first point twice
    Next
    If (existingFeature.Coordinates.Count >= 2) Then
      lineF.InitializeVertices()
    End If
If you simply want to have one LineString feature that contains all the coordinates you passed to the function, you could do it like this:
    Dim lineFeature As DotSpatial.Data.IFeature = lineF.AddFeature(New LineString(coords)) //create a new linestring feature with the given coordinates 
    lineFeature.DataRow("Owner") = "THE OWNER"
    lineFeature.DataRow("OwnedSince") = Now.ToShortDateString
    lineF.InitializeVertices()
Make sure that your LineStrings contain at least 2 different points, otherwise you'll get problems with invalid geometries.

New Post: M Values for points or lines

$
0
0
Wow. I made that harder than it should be. Thanks for that help.

I made the changes you showed and I still get NaN for Z and M.

Here is the code as it is now.

Private Function AddPolyLineFeatureToShape(coords As List(Of Coordinate), columns As ObservableCollection(Of PointColumns)) As DotSpatial.Data.FeatureSet
        Dim lineF As FeatureSet = New FeatureSet(FeatureType.Line)
    Try
        lineF.Projection = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984
        lineF.CoordinateType = CoordinateType.Z
        For i = 0 To columns.Count - 1
            Dim column As DataColumn = New DataColumn(columns(i).ColumnName)
            Select Case columns(i).ColumnType
                Case Is = "String"
                    lineF.DataTable.Columns.Add(New DataColumn(columns(i).ColumnName, GetType(System.String)))
                Case Is = "Date"
                    lineF.DataTable.Columns.Add(New DataColumn(columns(i).ColumnName, GetType(System.DateTime)))
                Case Is = "Double"
                    lineF.DataTable.Columns.Add(New DataColumn(columns(i).ColumnName, GetType(System.Double)))
            End Select
        Next
        Dim lineFeature As DotSpatial.Data.IFeature = lineF.AddFeature(New LineString(coords))
        lineFeature.DataRow("Owner") = "THE OWNER"
        lineFeature.DataRow("OwnedSince") = Now.ToShortDateString
        lineF.InitializeVertices()
        lineF.SaveAs("D:\test.shp", True)
        Return lineF
    Catch ex As Exception
        MsgBox(ex.Message & ex.StackTrace)
        Return Nothing
    End Try

End Function

New Post: M Values for points or lines

$
0
0
Seems there is an error in DotSpatial. Have a look at issue 935. As soon as it is closed you can download the latest dlls. Then your AddPolyLineFeatureToShape should work correctly.

New Post: M Values for points or lines

$
0
0
Thanks! I really like what you guys are doing. Makes things for guys like me a lot easier.

New Post: Very simple point in Polygon test not working

$
0
0
I tried to find the answer for hours, but I ended up with nothing.. this is a mystery to me.

The following code should do a simple point in Polygon test, but it always returns false for the intersection (I am definitely providing lat/lng coordinates that lies within the polygon):
      'load Shapefile
      Dim filedialog As OpenFileDialog = New OpenFileDialog()
        filedialog.Title = "Select shapefile (WGS1984 Projection)"
        filedialog.InitialDirectory = "C:\temp" 'DE_WGS1984.shp
        filedialog.RestoreDirectory = True
        If filedialog.ShowDialog() = DialogResult.OK Then
            TextBox4.Text = filedialog.FileName
        Else
            Exit Sub
        End If
        Dim ShapefilePoly As Shapefile = Shapefile.OpenFile(TextBox4.Text)
      
      'lngP/latP is the coordinate to test against the shapefile, e.g. 13.380025, 52.52972

                Dim PhotoPoint As New DotSpatial.Topology.Coordinate(lngP, latP)
                For Each f As DotSpatial.Data.Feature In ShapefilePoly.Features
                    Dim pg As DotSpatial.Topology.Polygon = TryCast(f.BasicGeometry, Polygon)
                    If pg IsNot Nothing Then
                        If pg.Contains(New DotSpatial.Topology.Point(PhotoPoint)) Then
                            LiesWithin = True 'never triggered
                            Exit Function
                        End If
                    End If
                Next
Could this be a rounding issue, because DotSpatial.Topology.Coordinate truncates lat/lng values beyond 6 decimals?
Thanks so much for any help..

New Post: Distance On line

$
0
0
Is there a function like DistanceOnLine or PointAtDistance for a Polyline? I cannot seem to find any information on how to get either.

New Post: Very simple point in Polygon test not working

$
0
0
I am a step further.. it seems to have something to do with the Shapefiles I am using. There are some types of Shapefiles where the code works, for some other ones, it doesn't. Here are two example shapefiles (130kb):
ShapeA_B.zip

New Post: Home to zoom ini/out with scalebar


New Post: How to zoom in/out with trackbar

$
0
0
Hello guys,
Please help me, ini basic here..

New Post: Distance On line

$
0
0
What exactly is this function supposed to do?

New Post: Distance On line

$
0
0
I would like to give a distance on a line and have a point on that line returned. An the reverse of that as well, give a point on the line and have it return a distance.

This is all done in a service, without the use of a map. (That will come later in the process). With that as well, I think I saw a "nearest point on line" ?

New Post: Distance On line

Created Unassigned: reproject UTM to WGS84 [63640]

$
0
0
Hello Guys,

I have a problem while reprojecting from UTM ([MGI / Austria GK West](http://www.example.com)) to WGS84 (Lat/Lon), I have an error of about 500 m in Latitude and 50 m in Longitude, thats my VB.net code:

```
' lines
Sub processLines(fs As IFeatureSet)

' set EPSG code
fs.Projection.AuthorityCode = 31254

' Destination projection information
Dim dest As DotSpatial.Projections.ProjectionInfo = KnownCoordinateSystems.Geographic.World.WGS1984
dest.GeographicInfo = fs.Projection.GeographicInfo

' set EPSG code
dest.AuthorityCode = 4326

' reproject
fs.Reproject(dest)

...
```

I´m using Qgis to echeck the results. Thanks in Advance!

Oliver

New Post: Distance On line

Created Unassigned: Can't download the first tutorial [63641]

$
0
0
Hello,

On the [tutorial page](https://dotspatial.codeplex.com/wikipage?title=DotSpatial%20Tutorials) the link to the first tutorial "DotSpatialTutorial 1" is broken.

Please fix that.

New Post: First tutorial is missing

$
0
0
Hello,

On the tutorial page the link to the "Example Data" for the first tutorial "DotSpatialTutorial 1" is broken.

Please fix that.

Updated Wiki: DotSpatial Tutorials

$
0
0

Tutorials

Introduction to DotSpatial 1.7 for C#

The following tutorials have been updated to use DotSpatial 1.7. These tutorials are specifically for C#. For examples of VB code see the tutorials for DotSpatial 1.0.

DescriptionExample Data
Tutorial (1) Working with DotSpatial controls DotSpatialTutorial 1 
Tutorial (2) Working with DotSpatial Symbology and Attribute table DotSpatialTutorial 2
Tutorial (3) Raster data operations in DotSpatial DotSpatialTutorial 3
Tutorial (4) Shape file, Attribute table operations and Printing map in DotSpatial DotSpatialTutorial 4
Tutorial (5) Projection Explorer in DotSpatial DotSpatialTutorial 5
Tutorial (6) Raster Vector Data Analysis in DotSpatial DotSpatialTutorial 6
Tutorial (7) Label operations DotSpatialTutorial 7
Tutorial (8) Create a custom plug-in DotSpatial DotSpatialTutorial 8
Tutorial (9) Accessing GDAL data provider in DotSpatial DotSpatialTutorial 9
Testing Data ~ US states shape file states.zip

Should I create an extension or an application?

Extension Development

How to Create an Extension

Create an Extension to Import an Excel Worksheet

Create an Extension to Analyze Vector and Raster Data

Using PointSymbolizer on a DrawingLayer

How to Sort Layers Alphabetically

Using MEF Contracts to Coordinate Communication Between Extensions (Advanced)


Application Development

Basic DotSpatial Desktop Mapping

How to Support Loading Extensions (Loading GDAL)

How to Add Support for Loading DotSpatial.Plugins.Ribbon

How to Load DotSpatial Extensions Into My Toolbar

Composing an Application by Combining Extensions

Getting started with MEF (Managed Extension Framework)


How Do I (End User Documentation)

Finding and Installing the WebMap Extension

Getting Started with Attribute Data Explorer


Related Projects

How to Customize Branding of MapWindow 6

While the above tutorials use C# code examples, you may use a tool to convert C# to VB.NET.


Introduction to DotSpatial 1.0 for C# and VB

The following tutorials are developed by Tevaganthan and Daniel Ames, but they were written before the V1 release of DotSpatial and are out of date.

DescriptionExample Data
Tutorial (1) Working with DotSpatial controls DotSpatialTutorial 1 
Tutorial (2) Working with DotSpatial Symbology and Attribute table 
Tutorial (3) Raster data operations in DotSpatialDotSpatialTutorial  3
Tutorial (4) Shape file, Attribute table operations and Printing map in DotSpatial 
Tutorial (5) Projection Explorer in DotSpatial 
Tutorial (6) Raster Vector Data Analysis in DotSpatial 
Tutorial (7) Label operations 
Tutorial (8) Create a custom plug-in DotSpatial 
Tutorial (9) Accessing GDAL data provider in DotSpatial 
Testing Data ~ US states shape file states.zip

How to get selected Feature FID


Other languages

Jetzt gehts los – Die Anwendungsoberfläche erstellen

http://knowhowdevblog.wordpress.com/2012/05/17/anwendungsoberflache-erstellen/

http://knowhowdevblog.wordpress.com/category/gis-entwicklung/


Potential Future Tutorials

  1. How to manage gis layers by geoprocessing.
  2. How to implement a custom vector provider.
  3. How to implement a custom raster provider.
  4. How to serialize map or layer information.
  5. How to use GPS Data with the GPS DotSpatial classes.
  6. How to manage custom vector symbology (classified, unique values, charts, etc.)
  7. How to load ECW and MrSID images.
  8. How to clip polygons and lines with polygons and lines. 

Note. Put here your request to make one big tutorial page to allow another users learn how to collaborate with DotSpatial.NET project.

New Post: First tutorial is missing

$
0
0
Please check the link. It should be fixed now.

Closed Feature: Identifier doesn't work for Image Layer [249]

$
0
0
The built-in DotSpatial identifier on the SpatialToolStrip doesn't work with image layers:
1) Open DemoMap and add a raster layer to the map
2) Click the identifier "(i)" button on the main toolbar
3) Click on a point on the image in the map
An empty "FeatureIdentifier" dialog appears. I would expect the dialog to show the image (RGB) value and the image row,column at the clicked point.
Comments: This issue list is no longer active. This issue has been copied to our issue list on github (https://github.com/DotSpatial/DotSpatial/issues) Please check there to find out whether this issue was fixed.

Closed Feature: Save Projection of MapFrame to .dspx project file [245]

$
0
0
The information about projection and coordinate system of the current map frame should be serialized to the .dspx project file. Currently the ProjectionInfo is not serialized resulting in setting the map projection to "unknown" or "wgs84" when opening an existing project. When opening project, if the .dspx file contains projection information, the projection of the map should be set to the projection specified in the .dspx file. I suggest serializing the ProjectionInfo using its public members or using the EsriString property.

This is an important feature, because we'll have many different projects and each project may require a different projection.
Comments: This issue list is no longer active. This issue has been copied to our issue list on github (https://github.com/DotSpatial/DotSpatial/issues) Please check there to find out whether this issue was fixed.
Viewing all 3973 articles
Browse latest View live


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