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 7:16 PM
Hi,

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.

regards
Developer
Apr 3, 2008 at 6:22 PM
Edited Apr 4, 2008 at 8: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 4:01 PM
Hi

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?

regards
Apr 4, 2008 at 5:26 PM
Edited Apr 4, 2008 at 5:31 PM
Solve: This sample on VB.net 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);
'dbgeometries.Add(g);
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.Layers.Add(_layer)
'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.
'Me.Refresh()
Me.MapImage1.Map.Layers.Remove(_layer)
End Sub