Hi all,
I have a map control, I add some ShapeFileFeatureLayer and then I add MapTool control, but when I show map page, my MapTools don't show! It lies below the image map. Help me, please!
Hi all,
I have a map control, I add some ShapeFileFeatureLayer and then I add MapTool control, but when I show map page, my MapTools don't show! It lies below the image map. Help me, please!
Some code: public static void AddBasedMap(Map map) { private static void createBasedLayer(Map map, String path) { // ...............
map.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"));
map.MapUnit = GeographyUnit.DecimalDegree;
map.MapTools.MouseCoordinate.Enabled = true;
map.MapTools.MouseMapTool.Enabled = true;
map.MapTools.ScaleLine.Enabled = true;
map.MapTools.PanZoomBar.Enabled = true;
map.MapTools.AnimationPanMapTool.Enabled = true;
map.MapTools.Logo.Enabled = false;
createBasedLayer(map, HttpContext.Current.Server.MapPath("~/MapData/World/cntry02.shp"));
createSeaGridLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/BiendongGrid/GridBiendong_polyline.shp"));
createVNLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_ellipse.shp"));
createVNLineLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_polyline.shp"));
createVNPointLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_point.shp"));
createVNRegionLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_region.shp"));
createVNTextLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_text.shp"));
}
ShapeFileFeatureLayer baseLayer = new ShapeFileFeatureLayer(path);
baseLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 243, 239, 228), GeoColor.FromArgb(255, 218, 193, 163), 1);
baseLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level10;
map.StaticOverlay.Layers.Add("BaseLayer", baseLayer);
}
public static void AddBasedMap(Map map) {
map.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"));
map.MapUnit = GeographyUnit.DecimalDegree;
map.MapTools.MouseCoordinate.Enabled = true;
map.MapTools.MouseMapTool.Enabled = true;
map.MapTools.ScaleLine.Enabled = true;
map.MapTools.PanZoomBar.Enabled = true;
map.MapTools.AnimationPanMapTool.Enabled = true;
map.MapTools.Logo.Enabled = false;
createBasedLayer(map, HttpContext.Current.Server.MapPath("~/MapData/World/cntry02.shp"));
createSeaGridLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/BiendongGrid/GridBiendong_polyline.shp"));
createVNLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_ellipse.shp"));
createVNLineLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_polyline.shp"));
createVNPointLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_point.shp"));
createVNRegionLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_region.shp"));
createVNTextLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_text.shp"));
}
private static void createBasedLayer(Map map, String path) {
ShapeFileFeatureLayer baseLayer = new ShapeFileFeatureLayer(path);
baseLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 243, 239, 228), GeoColor.FromArgb(255, 218, 193, 163), 1);
baseLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level10;
map.StaticOverlay.Layers.Add("BaseLayer", baseLayer);
}
Hi Tran,
I tested your code but it looks everything goes well here. I think your code don’t have problem.
If you still have this problem, could you create a simple sample for reproduce that, so that I can help you find the reason?
Here is my test code:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
AddBasedMap(Map1);
}
}
public static void AddBasedMap(Map map)
{
map.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"));
map.MapUnit = GeographyUnit.DecimalDegree;
map.MapTools.MouseCoordinate.Enabled = true;
map.MapTools.MouseMapTool.Enabled = true;
map.MapTools.ScaleLine.Enabled = true;
map.MapTools.PanZoomBar.Enabled = true;
map.MapTools.AnimationPanMapTool.Enabled = true;
map.MapTools.Logo.Enabled = false;
createBasedLayer(map, HttpContext.Current.Server.MapPath("~/SampleData/World/cntry02.shp"));
//createSeaGridLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/BiendongGrid/GridBiendong_polyline.shp"));
//createVNLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_ellipse.shp"));
//createVNLineLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_polyline.shp"));
//createVNPointLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_point.shp"));
//createVNRegionLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_region.shp"));
//createVNTextLayer(map, HttpContext.Current.Server.MapPath("~/MapData/Nen/VietNameShape/Vietnam_text.shp"));
}
private static void createBasedLayer(Map map, String path)
{
ShapeFileFeatureLayer baseLayer = new ShapeFileFeatureLayer(path);
baseLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 243, 239, 228), GeoColor.FromArgb(255, 218, 193, 163), 1);
baseLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level10;
map.StaticOverlay.Layers.Add(“BaseLayer”, baseLayer);
}
Regards,
Don
I cant create a sample as you say, because my aspx code is very long! But I can supply some error image to you!
MapTool lies below the image map, and the error only happens on IE, not on Firefox!
Images link:
docs.google.com/leaf?id=0B3QAJrjpQxGnOGM1NTliYTQtMTFlZS00ODE1LTk0MDQtMmE4OWY1MGVkZGFh&hl=en_US
Hi Tran,
Your link cannot be open. Could you upload your image as attach file in this post?
I think your problem will related with environment or some other code in your project. Because I test the code you provide but everything works well both in IE ,FF and Chrome.
Regards,
Don