This project has moved and is read-only. For the latest updates, please go here.

Render a WKT Poligon Sample?

Topics: Data Access, Español, General Topics, SharpMap Project, SharpMap v0.9 / v1.x, SharpMap v2.0, WinForms Controls
Apr 2, 2008 at 8:16 PM

I begin with sharpmap and try to render only one poligon in map (win32), any have a simple sample to render this. I confused with many and many properties. I really very happy for you response.

Apr 3, 2008 at 7:22 PM
Edited Apr 4, 2008 at 9:39 PM
If you want to create your own polygon in code you could use GeometryProvider. There is an example in GeometryFeature.aspx.cs in DemoWebSite.
Apr 4, 2008 at 5:01 PM

I try but the sample only draw a point, I try to modify the code to use a poligon but have some errors. Any have a practical sample?

Apr 4, 2008 at 6:26 PM
Edited Apr 4, 2008 at 6:31 PM
Solve: This sample on Draw a WKT from a textbox (txtWKT) like POLYGON ((626 368, 451 363, 440 420, 620 410, 626 368))

Private Sub btnWKT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWKT.Click
'g = SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse(webGetdataOut.wsrepobjectvarrayOuti.geometry);
Dim _geometria As Geometry
_geometria = GeomFromText(txtWKT.Text)
Dim _layer As New SharpMap.Layers.VectorLayer("LayerName")
layer.DataSource = New SharpMap.Data.Providers.GeometryFeatureProvider(geometria)
'Me.MapImage1.Map.ZoomToExtents() ' Zoom al mapa
'Me.MapImage1.Map.Zoom = Me.MapImage1.Map.Zoom * 1.1 ' ZoomOut a 10%
'Me.MapImage1.Refresh() ' Refrescar el mapa y visualizarlo en el formulario.
End Sub