making points on a vector layer

Topics: SharpMap v0.9 / v1.x
Feb 18, 2014 at 10:49 AM
  1. can i make simple points with different colors in sharpmap based on my click on a raster layer.
  2. can i give an input of cordinates and make a layer of points
Developer
Feb 19, 2014 at 2:14 AM
shamsherk wrote:
  1. can i make simple points with different colors in sharpmap based on my click on a raster layer.
  2. can i give an input of cordinates and make a layer of points
Yes, you can use a lector layer overlaid on the Raster to show the points, it should be trivial to use GeometryFeatureProvider as the layer provider
Feb 27, 2014 at 8:07 AM
I have done so bt my point is offset from my actual click
Coordinator
Mar 4, 2014 at 6:55 PM
Keep in mind that we have next to no idea what you are doing. You need to be specific about what you are doing and the issue you are seeing, then we can help you.
Editor
Mar 5, 2014 at 2:43 PM
make sure you are converting between image coordinates and map coordinates.

So on mouse click you would have to do this.

var clickLocation =Map.ImageToWorld(e.Location);

clickLocation will be your real world location
Apr 28, 2014 at 8:49 AM
sry for being less specific my code to fetch the coordinate of a point is

Private Sub MapCoord(ByVal strLabel As Char)
    If strLabel = "c" Then
        Dim ptClick = mapbxMain.Map.ImageToWorld(New PointF(MousePosition.X, MousePosition.Y))
        lblCoordE.Text = ptClick.X.ToString
        lblCoordN.Text = ptClick.Y.ToString()
    Else
        lblPanCoord.Text = ptClick.X.ToString & "," & ptClick.Y.ToString
    End If

End Sub
Editor
Apr 28, 2014 at 11:07 AM
And what is the issue that you are seeing?
Apr 28, 2014 at 11:42 AM
the coordinates are inconsistent... when i zoom in close i see correct cordinates but when zoomtoextents the cordinates are way off.
Editor
Apr 28, 2014 at 2:18 PM
Behaviour like this often comes down to rounding errors. Make sure you are not round the coordinates otherwise they will not plot correctly.

The reason they get better as you zoom in is because the margin for error (ie the size of the viewport) is decreasing so the rounding has less of an effect.
Apr 30, 2014 at 4:51 PM
but as my code says i m not rounding it
Editor
Apr 30, 2014 at 10:31 PM
Your code sample is just setting text fields. You have not shown any code that shows how you are plotting the data.

If you are using ToString, then you are rounding the values, as double.ToString does round the values. Make sure you pass the coordinates as doubles not strings