This project has moved. For the latest updates, please go here.

i want to draw some points into the map from client

Topics: SharpMap v0.9 / v1.x
Feb 21, 2008 at 1:14 AM
i am using the SharpMap v0.9 and studing the ajaxMap

i want to draw some points into the map from client, but it seems that all layers of the map added at first
i can not add a new layer when the server is running

as follow is my test in Ajax.aspx.cs:

protected void Page_Load(object sender, EventArgs e){
ajaxMap.Map = MapHelper.InitializeMap(new System.Drawing.Size(10, 10));
if (!Page.IsPostBack && !Page.IsCallback)
//Set up the map. We use the method in the App_Code folder for initializing the map
SharpMap.Geometries.BoundingBox mapExtents = ajaxMap.Map.GetExtents();
ajaxMap.Map.Center = new SharpMap.Geometries.Point(0, 0);
ajaxMap.Map.Zoom = mapExtents.Width;
ajaxMap.FadeSpeed = 10;
ajaxMap.ZoomSpeed = 10;
ajaxMap.Map.Zoom = 360;

// add point
protected void AddPoint()

// create layer
protected void CreateGeometryLayer()
SharpMap.Layers.VectorLayer layer = new SharpMap.Layers.VectorLayer("geolayer");
List<SharpMap.Geometries.Geometry> geoList = new List<SharpMap.Geometries.Geometry>();
geoList.Add(new SharpMap.Geometries.Point(10, 10));
geoList.Add(new SharpMap.Geometries.Point(30, 30));
geoList.Add(new SharpMap.Geometries.Point(50, 50));
geoList.Add(new SharpMap.Geometries.Point(70, 70));
geoList.Add(new SharpMap.Geometries.Point(90, 90));
layer.DataSource = new SharpMap.Data.Providers.GeometryProvider(geoList);
layer.SRID = 4326;


private void GenerateMap()
ajaxMap.ResponseFormat = "maphandler.ashx?MAP=SimpleWorld&Width=WIDTH&Height=HEIGHT&Zoom=ZOOM&X=X&Y=Y&Layers=LAYERS";