Hi Everyone,
I am loading a line shp file which has 474387 features in it.
it does not load at all.
request is sent to tile_georesource.axd but broken images are being returned.
I have already run following functions against the shp file
1. BuildRecordIdColumn
2. BuildIndexFile
Zooming in and selecting small number of features works perfectly fine.
Any help will be appreciated.
Thanks
Large Shape file
Hi, pradeep
We have tested it with Texas road data which has 2972351 features in it. It works well other than performance problem.
If you still couldn’t load it, please provide us which version of web edition you are using. Also, send us the code and data to help us recreate your issue. We’ll check it out. If your project is too big, please send to support@thinkgeo.com and ask to forward to me.
Thanks,
Khalil
Hi Khalil,
Thanks for the reply and apologies for delayed response.
I have uploaded the code to
hireconsultant.com.au/thinkgeo/
download RoadShpFile.zip
this contains sample app and the shp file as well.
default.aspx performs way too slow.
I have added comments in the code to explain the functionality as well.
Eagerly awaiting your positive reply.
Thanks,
Prady
Hi, Prady
Sorry for delay response. I have downloaded your app and data, and then test it on my machine. It works well but it renders slowly. I can’t recreate your first problem about broken images are returned. You could add cache for server-side and client-side to improve performance.
If you still have any problems please let me know.
Thanks,
Khalil
Hi Khalil,
Thanks for the reply.
I guess broken images is caused because server was taking way too long to respond.
so, there is nothing we can do about the slow performance other than adding caches?
is there any other better way of achieving the same results?
also, with caches, I tried it some time ago but I could not make it work.
I would appreciate if you can point me to a sample code which shows how to add caches for both server and client side.
Thanks,
Prady
Hi, Prady
Yes, cache maybe is the best way to solve this problem. You could add both server and client side cache using the code below:
Map1.StaticOverlay.ClientCache.CacheId = "WorldOverlay";
Map1.StaticOverlay.ServerCache.CacheDirectory = MapPath("~/ImageCache/" + Request.Path);
If you have added server cache to app, the first time you visit the map will be more slower, that's because you not only need to render images but also need to save images to cache, this situation will change from second time on.
If you want to make it more efficient, you could generate the all cache images in advance, for example, you could firstly generate the all tile cache images for ZoomLevel01 to ZoomLevel05.
Thanks,
Khalil
Hi Khalil,
As you have noticed the only thing which is slowing down is my custom code to classify the layers into sub layer.
for example, if layer has 10 types of features, I need to show them in 10 different colors, shapes, etc.
and to do this, my custom draw function is being used.
How about if I load 10 in memory layers (refer to my code plz) and then I will not have to use my custom draw function.
Do you think it will be better approach?
do you think it will improve the efficiency?
Prady,
I noticed you have created your own line style by using CreateSimpleLineStyle static method of LineStyles class, and there is a performance problem about it. We will generate a default center pen for this line style, so it will slow down the app. You could use the code below instead of it:
GeoPen outerPen = new GeoPen(outlineCol, outlineWidth);
GeoPen innterPen = new GeoPen(fillColour, width);
LineStyle lineStyle = new LineStyle(outerPen, innterPen);
return lineStyle;
//return LineStyles.CreateSimpleLineStyle(fillColour, width, lineDashStyle, outlineCol, outlineWidth, LineDashStyle.Dash, false);
And also, I suggest that you set the cache for your app, it will improve your performance.
Thanks,
Khalil
Thanks Khalil,
what are your views about the solution I posted in my previous post
Prady,
I think there is no need to do that, and it will not improve the efficiency of your app. Maybe it will cause memory leak problem.
Thanks,
Khalil
Thanks Khalil,
So just to sum it up.
The only performance enhancements we can do are
1. use server & client side caching
2. do not use CreateSimpleLineStyle
apart from that there is nothing we can do.
also, just wanted to confirm, if my approach of adding in memory dynamic layers for showing selections is correct?
or is there any better way?
Thanks for all your help
Prady,
Yes, there two ways to improve the performance of your app:
1. Add server & client caching. If you want to enhance the user experience further, just as I have mentioned in my previous post that you could pre-generate the whole server tiles cache for some higher zoom levels.
2. Don’t use CreateSimpleLineStyle static method.
yes, if you want to display the features which users select with different styles. I think that adding a layer such as InMemoryFeatureLayer is the best way to implement that.
I noticed that you put InMemoryFeatureLayer into session in your code, I guess there is no need to do that if you just want to display features users select.
Thanks,
Khalil
Thanks,
Khalil
I Khalil,
i tried using server caching.
But we have huge problem.
when user is working on the maps, user can hide the layer altogether.
this doesnt work at all when using caching.
is it a bug??
and in Visual studio, I get this tooltip
"we could make changes to the server cache. if you are using server cache , please contact support at thinkgeo"
forgot to mentioned that I am using IsVisible=false
to hide the layer
Hi, Prady
I notice that you set the IsVisible property on the layer which you want to hide it. It doesn't work in your scenario, and the server still will get tile image from cache but it won't draw on the fly. Maybe you need to set this property on the overlay which loads layers. In your code you may implement it using the code below:
Map1.StaticOverlay.IsVisible = false;
Thanks,
Khalil
Hi Khalil,
The problem is if I hide StaticOverlay, it will hide all layers on it.
We load 12 to 15 layers on staicoverlay for each user.
Prady,
You could use another LayerOverlay to load layers which you want to hide. The code likes below:
LayerOverlay overlay = new LayerOverlay();
overlay.IsVisible = false;
overlay.Layers.Add(tmpLayer);
Map1.CustomOverlays.Add(overlay);
Thanks,
Khalil
ok,
so u mean, if I have 15 layers for the user.
I add 15 layeroverlays?
how about performance hit for this approach?
Prady,
Yes, performance problem does exists. But you could add server cache for every overlay to improve it.
Thanks,
Khalil
there is one more problem.
for each layer (and now each overlay), user can hide/show some features.
for example, when map loads, it will show 100 features and now user can make changes so that only 50 features are displaying and rest 50 are hidden using featuredIdsToExclude property.
Will the server caching still work?
Thanks for all your help.
I am very thankful.