I have shape file for the map of Pakistan and it is getting displayed with some other information which I am loading from my SQL Server database. I want to display the Map of Pakistan when the Page is loaded, but it is coming on the right side and I have to drag it to view. I think by using currentExtent property we can setup, but I have tried different options not able to do so. I need help to sort this.
Load the map which is in your shape file when the page is loaded
Hi Naeem,
I don’t think that’s related with your loading from SQL server.
If possible please upload a sample which can reproduced that.
If you don’t want to upload a sample please do something as below:
Test 1. Disable loading SQL server related code and test whether the issue still there. If the issue still there, go test 2. If the issue won’t happen, we still need your sample project.
Test 2. Put your code into any sample in our HowDoISamples project, and use our data in the project instead of your Pakistan data. Then test whether it solved. If it still can be reproduced, please just sent us your test code. If it cannot be reproduced by our data, you should want to sent us your Pakistan data also.
Regards,
Don
Thanks Don for your reply.
Following is my code, I want to show Map of Pakistan on screen when the page is loaded. currently I have to drag it from right side.
map =
New
Map(
“Map1”
,
New
System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), 510)
map.CurrentExtent =
New
RectangleShape(-1.4575022977941, 41.96396484375, -1.2297679227941, 30.36240234375)
map.MapUnit = GeographyUnit.DecimalDegree
usStatesLayer = GetCustomDataShapeFileFeatureLayer()
Dim
TextLayer
As
New
ShapeFileFeatureLayer(Server.MapPath(
"~/Content/Shapes/PAK_adm1.shp"
))
TextLayer.RequireIndex =
False
TextLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.City1
TextLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.City1(
"[Abbr]"
)
TextLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
'Dim TextOverlay As New LayerOverlay()
'TextOverlay.Layers.Add(“Names”, TextLayer)
'TextOverlay.IsBaseOverlay = True
Dim
staticOverlay
As
New
LayerOverlay()
staticOverlay.Layers.Add(
“Names”
, TextLayer)
staticOverlay.Layers.Add(
“Cities”
, usStatesLayer)
staticOverlay.IsBaseOverlay =
False
map.AdornmentOverlay.Layers.Add(BuildLegend())
map.CustomOverlays.Add(staticOverlay)
Thanks Don,
I am able to figure it out.
Naeem,
Great to hear you figure it out. Please let us know if any questions.
Thanks,
Troy