Showing posts with label ESRI. Show all posts
Showing posts with label ESRI. Show all posts

Friday, February 8, 2008

Using a ScaleDependentRenderer in a FeatureGraphicsLayer?

I was looking for a relationship between the classes FeatureGraphicsLayer and ScaleDependentRenderer. I could not find it in the EDN website. This is why I was looking for this: say you have a FeatureGraphicsLayer in which you want to draw features using a ValueMapRenderer. This is all OK since a ValueMapRenderer is "type of" IRenderer which is used by the FeatureGraphicsLayer.

However, what if you want to draw those features with a height/width that changes according to the scale? There is no IScaleDependentRenderer in the WebADF API. Philip Thompson posted a suggestion here:

http://forums.esri.com/Thread.asp?c=158&f=2276&t=245890#751096

Basically, we can extend his code snippet to set the Renderer on-the-fly everytime the ScaleChanged() method of the class Map is triggered. In this case, the Renderer will be set according to the scale. Thanks Philip!

protected void Map1_ScaleChanged(object sender, ESRI.ArcGIS.ADF.Web.UI.WebControls.ScaleEventArgs args)
{
if (args.NewScale > 4000)
{
foreach (MapResourceItem item1 in this.MapResourceManager1.ResourceItems)
{
if (item1.Definition.DataSourceType == "GraphicsLayer")
{
item1.DisplaySettings.Visible = false;
// OR RESET THE RENDERER AS WELL
}
}
}
if (args.NewScale < 4000)
{
foreach (MapResourceItem item1 in this.MapResourceManager1.ResourceItems)
{
if (item1.Definition.DataSourceType == "GraphicsLayer")
{
item1.DisplaySettings.Visible = true;
}
}
}
}

Sunday, January 6, 2008

Image Server 9.2 - Imagery resolution

I then changed the parameter to PNG24 and then compared the size of the file that is
created and then sent to the client. To my surprise, the results really affect the
performance of the application. For example, with PNG8 the file size is ~150KB, but
with PNG24 it can be up to ~750KB.

When you include the fact that it might be loading more than one image by more than one
user, performance can be even more critical! There are other factors, like the
available bandwidth.

One last test was about using JPEG as the image format. JPEG is really similar to JPG8
when talking about the image size. Therefore, you should be careful when choosing the
Image Format.