Creating a polygon

Aug 19, 2014 at 2:26 AM
How do I create a polygon with vertices? I use the following and it doesnt seem to work.

pNewShape = New MapWinGIS.Shape
For j = 0 To n
GetXY(j,x,y)
pNewShape.AddPoint(x, y)
next

any ideas?
Aug 19, 2014 at 6:53 AM
I have
MapWinGIS.Shape s = new MapWinGIS.Shape();
s.Create(MapWinGIS.ShpfileType.SHP_POINT);
MapWinGIS.Point p = new MapWinGIS.Point();
p.x = x;
p.y = y;
s.InsertPoint(p, ref inds);



2014-08-19 3:26 GMT+02:00 mr_sriramesh <[email removed]>:

From: mr_sriramesh

How do I create a polygon with vertices? I use the following and it doesnt seem to work.

pNewShape = New MapWinGIS.Shape
For j = 0 To n
GetXY(j,x,y)
pNewShape.AddPoint(x, y)
next

any ideas?

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Coordinator
Aug 19, 2014 at 4:43 PM
Which version of MapWinGIS are you using? AddPoint was added as a shorthand for velsto his snippet in v4.9.0.
Here's the documentation: http://www.mapwindow.org/documentation/mapwingis4.9/class_shape.html#a0f5afe1392c783538749617b8b5dd7db

And don't forget you need to add the new polygon to the shapefile before you can see it, using EditAddShape: http://www.mapwindow.org/documentation/mapwingis4.9/group__shapefile__editing.html#ga28c5f35af761b4a264af3bcd01e9befb

Paul
Aug 19, 2014 at 7:13 PM
Thanks Paul and Velsto. The thing I missed was "Create(MapWinGIS.ShpfileType.SHP_POLYGON);" I think it is working fine now.
Marked as answer by pmeems on 8/20/2014 at 1:45 AM