Hello,
I am trying to create a sample application which can use tile cached images for raster data. I used tilecachegenerator from the wiki and modified it for the raster layer.
GeoTiffRasterLayer rasterLayer2 = new GeoTiffRasterLayer(@"S:\IMAGERY\ISC\48 18 W3\48_18_3_RGB.tif");
layersToCache.Add(rasterLayer2);
I am using the raster layer extent to fix the extent of cache
InitializeComponent();
Collection<Layer> layerToCache=LayerProvider.GetLayersToCache();
RectangleShape rectBoundingBoxComplete = null;
RectangleShape rectBoundingBoxLayer;
foreach (Layer layer in layerToCache)
{
if(!layer.IsOpen)
layer.Open();
if (layer.HasBoundingBox)
{
rectBoundingBoxLayer = layer.GetBoundingBox();
if (rectBoundingBoxComplete == null)
{
rectBoundingBoxComplete = rectBoundingBoxLayer;
}
else
{
rectBoundingBoxComplete.ExpandToInclude(rectBoundingBoxLayer);
}
}
layer.Close();
}
if (rectBoundingBoxComplete != null)
{
txtUpperLeftX.Text = rectBoundingBoxComplete.UpperLeftPoint.X + "," + rectBoundingBoxComplete.UpperLeftPoint.Y;
txtLowerRightX.Text = rectBoundingBoxComplete.LowerRightPoint.X + "," + rectBoundingBoxComplete.LowerRightPoint.Y;
}
But when I try to display this raster in my mvc application, I am seeing some extra duplicate tiles at different location (please see attachment). I have tried to generate tiles several times but the result is same. The projection of raster is utm 13 N, NAD 83 and I am using mapunits as meter in tilecache generator code. I am not sure what is going wrong here. Here is my mvc code:
@{
ViewBag.Title = "Index";
}
@using System.Collections.ObjectModel
@using ThinkGeo.MapSuite.MvcEdition
@using ThinkGeo.MapSuite.Core
@{
Collection<Layer> layerList=new Collection<Layer>();
GeoTiffRasterLayer rasterLayer1 = new GeoTiffRasterLayer(@"S:\IMAGERY\ISC\48 19 W3\48_19_3_RGB.tif");
GeoTiffRasterLayer rasterLayer2 = new GeoTiffRasterLayer(@"S:\IMAGERY\ISC\48 18 W3\48_18_3_RGB.tif");
rasterLayer1.UpperThreshold = double.MaxValue;
rasterLayer1.LowerThreshold = 0;
rasterLayer2.UpperThreshold = double.MaxValue;
rasterLayer2.LowerThreshold = 0;
//Proj4Projection proj4 = new Proj4Projection();
//proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326);
//proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
//rasterLayer1.ImageSource. = proj4;
//LayerOverlay RasterOverLay=new LayerOverlay();
//RasterOverLay.Layers.Add(rasterLayer1);
//RasterOverLay.Layers.Add(rasterLayer2);
// layerList.Add(rasterLayer1);
layerList.Add(rasterLayer2);
RectangleShape rectBoundingBoxComplete = null;
RectangleShape rectBoundingBoxLayer;
foreach (Layer layer in layerList)
{
if (!layer.IsOpen)
{
layer.Open();
}
if (layer.HasBoundingBox)
{
rectBoundingBoxLayer = layer.GetBoundingBox();
if (rectBoundingBoxComplete == null)
{
rectBoundingBoxComplete = rectBoundingBoxLayer;
}
else
{
rectBoundingBoxComplete.ExpandToInclude(rectBoundingBoxLayer);
}
}
layer.Close();
}
;
Html.ThinkGeo().Map("Map1", 1029, 1024)
.MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"))))
.CurrentExtent(rectBoundingBoxComplete.UpperLeftPoint.X, rectBoundingBoxComplete.UpperLeftPoint.Y, rectBoundingBoxComplete.LowerRightPoint.X, rectBoundingBoxComplete.LowerRightPoint.Y)
.MapUnit(GeographyUnit.Meter)
//.MapTools(tools =>
//{
// tools.LoadingImageMapTool().Enabled(true);
//})
//.CustomOverlays(overlay =>
// {
// overlay.GoogleOverlay();
// overlay.LayerOverlay("RasterOverLay", true, TileType.MultipleTile).Layer (rasterLayer1);
// //overlay.LayerOverlay("RasterOverLay", true, TileType.MultipleTile).Layer(rasterLayer2);
// }
// )
.StaticOverlay(overlay =>
{
//overlay.Layer(rasterLayer1);
overlay.Layer(rasterLayer2);
//TileType tType=new TileType();
//tType. = TileType.MultipleTile;
overlay.TileType(TileType.MultipleTile);
overlay.TileHeight(256);
overlay.TileWidth(256);
//overlay.Layer(rasterLayer2);
ServerCache sCache=new ServerCache (@"C:\Users\Chacko\Desktop\ServicesEditionSample_CacheGenerator_CS_120619\ServicesEditionSample_CacheGenerator_CS_120619\CacheFolder\RasterLayer2");
overlay.ServerCache(sCache);
//TimeSpan duration=new TimeSpan(8,0,0);
//ClientCache cCache=new ClientCache(duration,"rasterLayerClient");
//overlay.ClientCache(cCache);
}
)
.Render();
}
<h2>Index</h2>