VDS Technologies

 

Read Map from Session variable

11/23/2014 9:06:55 PM
Total Posts 28

Read Map from Session variable

Is possible to read map from session variable?


Map map = new Map();
map.ImageTempDirectory = "temp";
map.ImageFormat = ImageFormat.Png;
map.Height = Unit.Pixel(400);
map.Width = Unit.Pixel(300);

map.AddLayer(Server.MapPath("App_Data/shapes/") + "xxx.shp");

Session["map"]=map;

 

Call map on other method:

Map newMap=(Map) Session["map"];

 

is it possible?

 

 

 

 

11/24/2014 9:38:02 AM
MVP
Total Posts 323

Re: Read Map from Session variable

Yes, of course.

11/24/2014 9:05:57 PM
Total Posts 28

Re: Read Map from Session variable

Ok. thanks.

But my application handle large shape file about 500 megabyte. At least 25 user concurrent use this application.

When a new user hit the map page, every time load shape file and application is very slow.

is there any options to load map when application start and map save to session variable. When a new user hit map page then map load from session variable independently and bind to map control on page but no change on session variable map.

is it possible?

 

 

 

11/25/2014 2:10:55 AM
MVP
Total Posts 323

Re: Read Map from Session variable

AspMap does not load shapefiles into the memory. It only reads the headers of the files when you call AddLayer (each header is about 300 - 500 bytes). So, the real slowdown is somewhere else.

See the 'Mapping Basics/Performance Tips' topic in the documentation. You may enable sessions as described in this topic:

Enable the EnableSession property of the Map control to avoid adding layers and setting their properties on each postback, this property should be set to True in the 'Properties' window of Visual Studio. See the MapSession.aspx (former USAMap) sample in the standard samples on how to use sessions.

 

11/25/2014 2:19:18 AM
MVP
Total Posts 323

Re: Read Map from Session variable

Update: the USAMap sample has been renamed to the MapSession.aspx sample.

11/25/2014 2:48:27 AM
Total Posts 28

Re: Read Map from Session variable

ok thanks.

But my application handle large gis dataset. I am using following method for load gis dataset from session.

1. Convert shape file to esri personal geodatabase

2. Load data table from access mdb file to session variable on application start

3. Add layer on map from casting data table from session using AddShapeDataLayer method

 

Data table size on session about 1 GB and shape file size about 1GB.

my question is which method is faster add layer on map from sources:

1. Add layer from session variable

or

2. Add layer from shape file

 

Application concurrent user 20-50. Map Layer drill down facility. Map layer gis data not fixed, should be dynamically changed on user requirements.

This video  may for help your understanding

http://youtu.be/K3etaYh1lBM

 

 

 

11/27/2014 2:33:28 AM
MVP
Total Posts 323

Re: Read Map from Session variable

Seems as the reason of the slowdown is the DataTable. It cannot be spatially indexed, thereby it will be processed fully on each map update. We recommend to use the original shapefile, indexed by the Spatial Index Builder, which is included with AspMap. This is the fastest method, comparing to any other.

Another solution is to export the shapefile into a spatial database and create a spatial index for the table (our Spatial Exporter tool does both tasks - http://www.vdstech.com/spatialexporter.aspx). The data in the spatial database table can be changed via AspMap or ADO.NET.

The video at http://youtu.be/K3etaYh1lBM still do not make it clear why such a simple task as enabling a layer takes so much time. It is recommended to submit a support ticket with the source code.