This example demonstrates how to create a point shapefile by placing 1000 points randomly. Here is a screenshot with the results of the code execution.

using System;
using AxMapWinGIS;
using MapWinGIS;
namespace Examples
public partial class MapExamples
// <summary>
// Creates a point shapefile by placing 1000 points randomly
// </summary>
public void CreatePointShapefile(AxMap axMap1)
axMap1.Projection = tkMapProjection.PROJECTION_NONE;
var sf = new Shapefile();
// MWShapeId field will be added to attribute table
bool result = sf.CreateNewWithShapeID("", ShpfileType.SHP_POINT);
// bounding box for the new shapefile
double xMin = 0.0;
double yMin = 0.0;
double xMax = 1000.0;
double yMax = 1000.0;
// the location of points will be random
Random rnd = new Random(DateTime.Now.Millisecond);
// creating points and inserting them in the shape
for (int i = 0; i < 1000; i++)
var pnt = new Point();
pnt.x = xMin + (xMax - xMin) * rnd.NextDouble();
pnt.y = yMin + (yMax - yMin) * rnd.NextDouble();
Shape shp = new Shape();
int index = 0;
shp.InsertPoint(pnt, ref index);
sf.EditInsertShape(shp, ref i);
// adds shapefile to the map
axMap1.AddLayer(sf, true);
// save if needed
//sf.SaveAs(@"c:\points.shp", null);
The type of the shapefile.
Definition: Enumerations.cs:169
The set of available point symbols. They represent macros for modification of several properties of t...
Definition: Enumerations.cs:460
Commonly used map projections to be set in Form Designer (see AxMap.Projection property).
Definition: Enumerations.cs:1741
Map component for visualization of vector, raster or grid data.
Definition: AxMap.cs:56
A point object represents a point with x, y, Z, and M values. Shapes created by adding point objects ...
Definition: PointClass.cs:38
A shape object represents a geometric shape which can be added to a shapefile which is displayed in t...
Definition: Shape.cs:41
bool Create(ShpfileType shpType)
Creates a new shape of the specified type.
Definition: Shape.cs:154
bool InsertPoint(Point newPoint, ref int pointIndex)
Inserts the specified point object into the shape using the desired point index if possible.
Definition: Shape.cs:372
Provides a functionality for accessing and editing ESRI shapefiles.
Definition: Shapefile.cs:72
tkMapProjection Projection
Sets projection of the map. It providers 2 most commonly used coordinate system/projections to be eas...
Definition: AxMap.cs:2709
int AddLayer(object Object, bool visible)
Adds a layer to the map.
Definition: AxMap.cs:1342