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

New Post: specific extent brutile layer and save tilling image

$
0
0
hi every body.

im new. i tried to use brutile layer google map in my app c# dotspatial.

here is the image when im startup my app

Image

my question is,
  1. how to zoom a specific extent?. so, when i startup my app the map already in this extent.
    here is the image
    image
  2. when im offline the map not show image how to save tilling image google map brutile layer. so when im offline the map still show?.
thanks

alex

New Post: specific extent brutile layer and save tilling image

$
0
0
Does your projection is right?It seems your points are in the ocean

New Post: Field used for symbology, how to prevent to delete this column?

$
0
0
Hi,

I found a "dirty" solution for this Problem but I want to do it better.
What I Need is the Name of the field used for the symbology of the selected layer

This is my workarround to only show the not used fileds to remove

If _featureLayer.Symbology.LegendText <> dc.ToString Then
                       field.Add(dc.ToString)
End If



Here my Code:
        Private Sub _ButtonDeleteColumn_ExecuteEvent(ByVal sender As Object, ByVal e As ExecuteEventArgs)

            If Map1.Layers.Count > 0 Then
                For i = 0 To Map1.Layers.Count - 1
                    If Map1.Layers(i).LegendText = XpTabControl1.SelectedTab.Text Then

                        If FeatureLayerType(Map1, i) = "NonFeatureLayer" Then
                            Exit Sub
                            'MessageBox.Show("The layer is not a valid layer.")
                        Else

                            Select Case FeatureLayerType(Map1, i)
                                Case "PolyGon"
                                    _featureLayer = CType(Map1.Layers(i), MapPolygonLayer)
                                Case "PolyLine"
                                    _featureLayer = CType(Map1.Layers(i), MapLineLayer)
                                Case "Point"
                                    _featureLayer = CType(Map1.Layers(i), MapPointLayer)
                            End Select


                            If _featureLayer.DataSet.AttributesPopulated Then
                                Dim field As List(Of String) = New List(Of String)
                                Dim selectedField As List(Of String) = New List(Of String)
                               
                                For Each dc As DataColumn In _featureLayer.DataSet.DataTable.Columns

                                    If _featureLayer.Symbology.LegendText <> dc.ToString Then
                                        field.Add(dc.ToString)
                                    End If

                                Next
                                Dim del As DeleteFieldsDialog = New DeleteFieldsDialog(field)
                                If (del.ShowDialog = DialogResult.OK) Then
                                    If (MessageBox.Show(Msg.DeleteColumn_Confirm, Msg.App_Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes) Then
                                        selectedField = del.SelectedFieldIdList
                                    End If
                                End If
                                
                                For Each fi As String In selectedField
                                    _featureLayer.DataSet.DataTable.Columns.Remove(fi)
                                Next

                               Else
                                MessageBox.Show("Column edits are not yet supported for datasets with more than 50, 000 attributes", Msg.App_Name)
                            End If

                        End If
                    End If

                Next
            End If

        End Sub

New Post: specific extent brutile layer and save tilling image

$
0
0
when i try to change proj4string with many preojection, the map always in the ocean.

when i debug after Reproject.ReprojectPoints the value minXY and z always Nan or infinity

New Post: specific extent brutile layer and save tilling image

$
0
0
Just try to find right projection for shape file..You can do it using Qgis and openlayer plugin.When you find that you must reproject to googles projection and then it works.

Created Issue: Field used for symbology, how to prevent to delete this column? [25962]

$
0
0
Hi, If I use a field to make any symbology shading and open after this the Atribute Table Editor, I can remove this field as any other. This makes my app do not open the symbology property dialog anymore. The same happens with MapWindow 6.

Featureset.cs at this line

counts[i] = DataTable.Select(expressions[i]).Length;

Message=Cannot find column [V01]

Is there any way to check out if a column is used for symbology and disable deleting?

New Post: Field used for symbology, how to prevent to delete this column?

$
0
0
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.

New Post: specific extent brutile layer and save tilling image

$
0
0
i try to find right projection and i have a indonesian shapefile and running it to qgis, i copied the information extent and proj in properties to my code minx,miny, maxx maxy and sphericalMercator value.

but still have problem.

see my edited question.

thanks.

New Post: Find layer when rightclick on map view

New Post: specific extent brutile layer and save tilling image

$
0
0
I think there is still problem with projections,Try to install openlayer maps plugin on qgis and test if your layer places in right position ?
Don't set extend by minXY..Get extend from your layers extend.or zoom map to layer extend

New Post: specific extent brutile layer and save tilling image

$
0
0
_btLayer.Projection = KnownCoordinateSystems.Geographic.World.WGS1984;
THIS IS NOT TRUE! It should be:
_btLayer.Projection = KnownCoordinateSystems.Projected.World.WebMercator;

New Post: specific extent brutile layer and save tilling image

$
0
0
am2 : i installed openlayer maps plugin in my qgis. but how to test if my layer places in right position?. here is my capture qgis Image

FObermaier : i edited my question. but still not work. the map is always show world. i try to debugging dsMap.Extent.CopyFrom(EXTENTS) but the dsMap.Extent cant change.

Created Unassigned: Working with GeometryCollections [25965]

$
0
0
Intersecting two polygons can result in the returned feature to be of type GeometryCollection.
I can't seem to find much doco on how to enumerate through such collection and how to treat its inhabitants.

For instance, a feature of type GeometryCollection traps an error if you ask it for its Area, so I assume you have to enumerate through the collection and accumulate the individual areas, maybe even write each of the geometries separately to a featureset?

Would anybody have a couple of lines of code to show what to do with them?

Closed Unassigned: Working with GeometryCollections [25965]

$
0
0
Intersecting two polygons can result in the returned feature to be of type GeometryCollection.
I can't seem to find much doco on how to enumerate through such collection and how to treat its inhabitants.

For instance, a feature of type GeometryCollection traps an error if you ask it for its Area, so I assume you have to enumerate through the collection and accumulate the individual areas, maybe even write each of the geometries separately to a featureset?

Would anybody have a couple of lines of code to show what to do with them?
Comments: This is not an issue. Please ask your questions in discussions.

Commented Unassigned: Tool:Find Intersects in two featureSets [25730]

$
0
0
Hi,
I have written a simple tool that can be used to find intersections between two polygon featuresets.I think it would be nice to share it


-It will add a new column which shows the area of intersection,
-Main language is in Persian.You can change strings in your own language

```
// *******************************************************************************************************
// Product: InterSectionTool
// Description: Tool that Find polygons that has intersects in two featureclass
// Copyright & License: See www.DotSpatial.org.
// Contributor(s): Open source contributors may list themselves and their modifications here.
// Contribution of code constitutes transferral of copyright from authors to DotSpatial copyright holders.
//--------------------------------------------------------------------------------------------------------
// Name | Date | Comments
//--------------------|--------------------|--------------------------------------------------------------
// Majid Hojati | 9/15/2014 | First Release
// ********************************************************************************************************


using DotSpatial.Data;
using DotSpatial.Modeling.Forms;
using DotSpatial.Topology;
using System.Collections.Generic;

namespace LandManagment
{
/// <summary>
/// Clip With Polygon
/// </summary>
public class InterSectionTool : Tool
{
#region Constants and Fields

private Parameter[] _inputParam;

private Parameter[] _outputParam;

#endregion

#region Constructors and Destructors

/// <summary>
/// Initializes a new instance of the ClipRasterWithPolygon class.
/// </summary>
public InterSectionTool()
{
this.Name = "ابزار یافتن همپوشانی بین دو لایه";
this.Category = "تحلیل های مکانی";
this.Description = "به کمک این ابزار میتوانید همپوشانی بین دو لایه انتخاب را پیدا کنید";
this.ToolTip = "یافتن همپوشانی بین دو لایه";
}

#endregion

#region Public Properties

/// <summary>
/// Gets or Sets the input paramater array
/// </summary>
public override Parameter[] InputParameters
{
get
{
return _inputParam;
}
}

/// <summary>
/// Gets or Sets the output paramater array
/// </summary>
public override Parameter[] OutputParameters
{
get
{
return _outputParam;
}
}

#endregion

#region Public Methods

/// <summary>
/// Once the Parameter have been configured the Execute command can be called, it returns true if succesful
/// </summary>
public override bool Execute(ICancelProgressHandler cancelProgressHandler)
{
IFeatureSet polygon0 = _inputParam[0].Value as IFeatureSet;
IFeatureSet polygon1 = _inputParam[1].Value as IFeatureSet;

IFeatureSet output = _outputParam[0].Value as IFeatureSet;

// Validates the input and output data
if (polygon0 == null || polygon1 == null || output == null)
{
return false;
}

output.CopyTableSchema(polygon0.DataTable);
output.DataTable.Columns.Add("میزان همپوشانی");

if (cancelProgressHandler != null)
cancelProgressHandler.Progress(null, 16, "آغاز به کار");
ProgressMeter pm = new ProgressMeter(cancelProgressHandler, "یافتن همپوشانی ها",polygon0.Features.Count);
pm.StepPercent = 1;
pm.StartValue = polygon0.Features.Count+1;

int c = 0;
for (int i = 0; i < polygon0.Features.Count; i++)
{
IFeature PolygonFeat1=polygon0.Features[i];

pm.StartValue = polygon0.Features.IndexOf(PolygonFeat1);

Extent tolerant = PolygonFeat1.Envelope.ToExtent();
List<IFeature> resultS =polygon1.Select(tolerant);

if (resultS != null && resultS.Count != 0)
{

foreach (IFeature PolygonFeat2 in polygon1.Features)
{

bool basicCheck;

basicCheck = PolygonFeat1.Envelope.Intersects(PolygonFeat2.Envelope);
if (basicCheck)
{
bool Check1 = PolygonFeat1.Intersects(PolygonFeat2);
if (Check1)
{
IFeature intersectedF = null;
try
{
intersectedF = PolygonFeat2.Intersection(PolygonFeat1);
output.AddFeature(PolygonFeat1);

output.Features[c].CopyAttributes(PolygonFeat1);
output.Features[c].DataRow[19] = intersectedF.Area();
c=c+1;
// output.DataTable.ImportRow(polygon0.DataTable.Rows[i]);
}
catch { return false; }
}
}

}
}
else
{
output.Save();
}
output.Save();

}


return true;
}

/// <summary>
/// The Parameter array should be populated with default values here
/// </summary>
public override void Initialize()
{
_inputParam = new Parameter[2];
_inputParam[0] = new PolygonFeatureSetParam("لایه در صفحه ای نخست") { HelpText = "این فایل به عنوان لایه صفحه ای اولیه مورد استفاده قرار میگیرد" };
_inputParam[1] = new PolygonFeatureSetParam("لایه در صفحه ای دوم")
{
HelpText = "این فایل به عنوان لایه صفحه ای اولیه مورد استفاده قرار میگیرد"
};

_outputParam = new Parameter[1];
_outputParam[0] = new PolygonFeatureSetParam("محل ذخیره فایل خروجی") { HelpText = "این فایل شامل مواردی است که دارای همپوشانی است"};
}

#endregion
}
}
```
Comments: ** Comment from web user: pan054 **

Hi Majid,
Thanks for sharing that code.
Intersecting two polygons can result in the returned feature to be of type GeometryCollection. Am I right in believing that your tool would not cope with that (a GeometryCollection does not seem to have an Area).
Cheers


New Post: NULL values in the shape file records

$
0
0
I have a problem with saving attribute data to a shape file (see code below). I'm certain that the right data is in the FeatureSet datatable. However, after saving and reloading the FeatureSet, there are only null values in the datatable. This Is confirmed by opeing the shapefile in MapWinGIS and ArcGIS. Would anybody have a suggestion?
Public Sub TestAttribs(MyPolygons As IFeatureSet)
    Dim ResFeatures As New FeatureSet
    ' copy the datatable structure
    ResFeatures.DataTable = MyPolygons.DataTable.Clone
    ResFeatures.DataTable.Clear()
    ' put trivial stuff in the featureset
    For Each ThisPoly As Feature In MyPolygons.Features
        ResFeatures.AddFeature(ThisPoly)
        ResFeatures.Features.Item(ResFeatures.Features.Count - 1).CopyAttributes(ThisPoly)
        ResFeatures.Features.Item(ResFeatures.Features.Count - 1).DataRow.AcceptChanges()
        ResFeatures.Features.Item(ResFeatures.Features.Count - 1).DataRow.EndEdit()
    Next

    ' There is content in the rows of the ResFeatures datatable and #datatable rows = #features
    Dim NRows As Integer = ResFeatures.DataTable.Rows.Count
    Dim NFeatures As Integer = ResFeatures.Features.Count
    Dim ContentsBefore As String = ResFeatures.DataTable.Rows(2)(7)

    'save to shape file
    ResFeatures.DataTable.AcceptChanges()       ' to be sure
    ResFeatures.SaveAs("c:\NewPolys.shp", True)
    Dim fs As FeatureSet = FeatureSet.Open("c:\NewPolys.shp")
    ' rows contain NULL values
    Dim ContentsAfter As String = fs.DataTable.Rows(2)(7)

End Sub
Thanks

Source code checked in, #75510

$
0
0
- Added posibility to show a single linecap at a percentual offset from the startpoint - Spread the DecorationPoints evenly on lines with more than one part - Show DecorationPoints with offset always on the same side of the line as shown in the preview of the LineSymbol window - Corrected the direction of DecorationPoints on vertical lines - Flip first DecorationPoint back to initial position if FlipFirst and FlipAll are applied together

Closed Unassigned: How to show linecap at middle of Line [25384]

$
0
0
In my current project, I would like to show case line direction at the middle of line feature.

Please suggest a way to represent it. This is a really crucial issue for me.

Thanks in advance.
Comments: Resolved with changeset 75510: - Added posibility to show a single linecap at a percentual offset from the startpoint
- Spread the DecorationPoints evenly on lines with more than one part
- Show DecorationPoints with offset always on the same side of the line as shown in the preview of the LineSymbol window
- Corrected the direction of DecorationPoints on vertical lines
- Flip first DecorationPoint back to initial position if FlipFirst and FlipAll are applied together

New Post: NULL values in the shape file records

$
0
0
Hey pan,

please use ResFeatures.CopyTableSchema(MyPolygons) instead of ResFeatures.DataTable = MyPolygons.DataTable.Clone.

Clone creates DataColumns that have no length. That is the reason why DotSpatial doesn't save the data to the dbf.
CopyTableSchema should create correct DataColumns.

jany_

New Comment on "Documentation"

$
0
0
Thank you very much. Wish dotspatial go up and up. http://muabanpiano.net
Viewing all 3973 articles
Browse latest View live


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