I think there maybe two places caused the problem. 1. From the name of shp file, it might represent the polyline shape, but you set area style, you can set line style. 2. mytown is your layer, but you don’t add it to map, you can add it to layerOverlay first and add layerOverlay to map second, the second step you have already done.
However, the polyline map is not shown and the map area is still blank. I am intended to draw the map of Singapore and the shp file represents the street layer. I think there must be something wrong with my LineStyles setting for the DefaultLIneStyle. I don't know which LineStyles.xxx should be there for this purpose. In MapSuite explorer, I can see the shp file contains a plethra of curved lines in black color. The blank map area looks gray. Do I need to set the LayerOverLay background color too?
From your updated code, I noticed that your map unit is decimal degree that means you want to use latitude/logitude coordinate for map, however the current extent you set is out of the boundary I think, the singapore should be at latitude 0.0, longitude 105.0 around.
background color just make the map look better, you don’t have to do it.
Also I found you set zoomlevel might not what you want, mytown.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level01; The style of zoom level 01 is applied until zoom level 01, that means the style only works for level 01, for another zoom level, the map won’t render, so I suggest you set it to mytown.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; to test if the problem is caused by this code.
I noticed the level problem and had rectified it as suggested in the Sample. However, the problem persisted. What I don’t know is how to set the current extent to the lat/lon of Singapore by using the API. Could you please shed light on the syntax? Thanks alot.
It seems working and the shp image is shown at a very condensed level at the centre of the map panel. When I zoom in, the shape is clearly visible and looks correct. My question is how to fine tune it so that the position and zoon level can be set at an appropriate level. The map panel is defined as a rectangle area by RectangleShape(-532.968, 222.89, 532.968, -222.89). How can I make the shp image enlarged and fill up the panel rectangle shape? Thanks. How do you find the lat/lon range of Singapore as mentioned above? Great work, thanks.
I don’t know the meaning of “The map panel is defined as a rectangle area by RectangleShape(-532.968, 222.89, 532.968, -222.89).”, do you mean you have to set CurrentExtent like that, if you have to do that I think you can only see Singapore very small, because compare Singapore’s extent, your extent is much larger, if you want to make shp image enlarge to fill up map control, you have to set current extent to Singapore’s extent.
Singapore is a very famous place which can easy find lat/lon at Google.
I am not very sure what your detail requirement, could you provide a simple sample to show what you want? And I can update its code to implement it.
This works great, thanks very much. In the application I have a dozen of layers to add with mytown the first layer. Do I have to do " OtherlayerName.Open()" if I want to show the labels in these layers? It seems that I need to create the index files for the other layer files seperately in order to perform "Open()". How do I generate the index file for a shp file? Thanks a lot.
I think Ryan’s code is working with you, do you have a try?
I have read the xaml you attached, my suggestion is that remove the setting for Width and Height of wpfMap(Height=“801” Width=“1039” ), so that it can auto resize and fill to parent control, also make sure wpfMap is inside a Grid control.
And about choose a certain zoomlevel, you also can set CurrentExtent to make it: // For example, get scale of zoomlevel2, so index is 1 double scale = new ZoomLevelSet().GetZoomLevels()[1].Scale; wpfMap1.CurrentExtent = ExtentHelper.ZoomToScale(scale, wpfMap1.CurrentExtent, wpfMap1.MapUnit, (float)wpfMap1.Width, (float)wpfMap1.Height);