ThinkGeo.com    |     Documentation    |     Premium Support

Beta 2 - Unable to add a ShapeFileFeatureLayer

Hi,


I'm trying the new beta version of MapSuite WebEdition 3.0. I ancounter an issue while trying to basically view a shapefile.


Here is my C# code :





protected void Page_Load(object sender, EventArgs e)
{
 Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4")); 
 Map1.MapUnit = GeographyUnit.DecimalDegree; 
 Map1.CurrentExtent = new RectangleShape(-131.22, 55.05, -54.03, 16.91); 
 Map1.MapTools.OverlaySwitcher.Enabled = true; 
 Map1.MapTools.MouseCoordinate.Enabled = true; 
 Map1.MapTools.PanZoomBar.Enabled = true; 

 ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(MapPath("~/TestData/cntry02.shp")); 
 worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1; 
 worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; 

 ShapeFileFeatureLayer statesLayer = new ShapeFileFeatureLayer(MapPath(@"~/TestData/States.shp")); 
 statesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.State1; 
 statesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; 

 Map1.StaticOverlay.Layers.Add(worldLayer); 
 Map1.StaticOverlay.Layers.Add(statesLayer); 

 



The results I always get for the image map is a white image (with the unlicensed mention) :

- Mouse coordinates are ok.

- shape files are at the right place,

- no exception is thrown,

- All my other tests are ok (WmsLayer using a non 4326 projection, integration of VirtualEarth...).

- ...


For your information, I'm using the evaluation version downloaded from your WebSite this morning. I also used the evaluation version of the previous beta which was ok for shape files.


I have certainly something wrong. But I can't see what !

Does somebody have an idea?


Thank you



Nicolas,


I copied your code into the DisplayASimpleMap sample application and a map of the US and World was displayed properly so the problem is not your code.


I expect that there is a problem with your evaluation license and this is the reason for a white map. Are you running your app on a Web server that does not have Map Suite installed on it or are you seeing this problem on your development machine?




I am having the same problem.  I just installed the new beta and am trying to run the sample app.  All of the maps are plain white.  The zoom bar is there and it seems to be responding to clicks and what not, but there is no visible map.  I’ve tried the other types of maps in the sample and am getting nothing.  Any ideas??? 
  
 Binu

The problem occured on my development computer (WinXP SP3, VisualStudio 2008 Pro SP1). I have tried many kind of use of feature layers and the problem is still the same. 

It seems that the problem is still the same with all kinds of FeatureLayer. 

- using ShapeFileFeatureLayer like in source code of my previous post

- using a InMemoryFeatureLayer filled from a ShapeFileFeatureLayer. The ShapeFile is correctly opened and parsed, features seem correct but the InMemoryFeatureLayer still white in the map,

- ...

Attached is my VisualStudio test project. Sample data are not include in the archive because of file size. Shapefiles can be obtained from MapSuite sample data. I don't know how to provide the SQL 2008 DB (4MB). This DB only includes an import of the cntry02 shapefile.


It should be usefull to include also my binaries of the MapSuite dll. But I can't because of file size limitation. If you think this is usefull, perhaps can I send them using email ?


Thanks



124-Geosys.Tests.MapSuite_v3beta2.zip (144 KB)

Nicolas and Binu, 
  
 This is a bug of our Evaluation Edition. Sorry for the inconvenience and we will solve this and release a new evaluation today (3.0.117). Also Nicolas, thanks very much for the test application you provided. 
  
 Ben 


Hi Ben, 
 Thanks very for the news. I’m waiting for your new release. 
  
 Nicolas

The new release is now available!

It seems that the new release (3.0.117) solves the issue partially.


FeatureLayers are now ok and can be displayed using the evaluation version. But it is still impossible to create a map using a WmsOverlay and a FeatureLayer. Here is my code for a sample.






protected void Page_Load(object sender, EventArgs e) 

if (!Page.IsPostBack) 

Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4")); 
Map1.MapUnit = GeographyUnit.DecimalDegree; 
Map1.CurrentExtent = new RectangleShape(-131.22, 55.05, -54.03, 16.91); 
WmsOverlay wms = new WmsOverlay("WMS Overlay"); 
wms.Parameters.Add("layers", "Countries02"); 
wms.ServerUris.Add(new Uri("wmssamples.thinkgeo.com/WmsServer.aspx")); 
wms.TileType = TileType.MultipleTile; 
wms.TileHeight = 256; 
wms.TileWidth = 256; 
ShapeFileFeatureLayer statesLayer = new ShapeFileFeatureLayer(MapPath(@"~/TestData/states.shp")); 
statesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.State1; 
statesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; 
Map1.CustomOverlays.Add(wms); 
//Map1.StaticOverlay.Layers.Add(statesLayer); 
Map1.MapTools.OverlaySwitcher.Enabled = true; 
Map1.MapTools.MouseCoordinate.Enabled = true; 
Map1.MapTools.PanZoomBar.Enabled = true; 
}
 } 



For this code, the URL used by OpenLayers to request the WMS server is:


wmssamples.thinkgeo.com/WmsS...HEIGHT=256


If I uncomment the line which add the FeatureLayer to the map, the URL for the WMS server is:


wmssamples.thinkgeo.com/WmsS...HEIGHT=256


This URL is not correct and "service", "version" and "request" WMS parameters are missing.


Another variant is when I try to add the FeatureLayer as a DynamicLayer in place of a StaticLayer. in this case, the WMS request is still incomplete. Another issue appeared when I tried to display only the DynamicLayer commenting the add of the WmsOverlay. In this last case, the map is completely incorrect. No layer is displayed and mouse coordinates are blocked on (0, 0).


Hoping this information will help you to debug your component,


Regards


Nicolas



Nicolas,


This is a bug; we will solve it in the next release. Now to work around, we need to add the javascript function as following. Here attached is the sample code, any more queries please let us know.


 




<script type="text/javascript">
        var OnMapCreating = function(map){
            Class.Extent(WmsOverlay.prototype,{
                        setParameters:function(json){
                            this.params = {};
                            this.setCustomerParams(json);
                        }
            });
        }
</script>


Ben

132-4800ForNicolas.zip (93.6 KB)

Thank you Ben,


This solves my WmsOverlay problem.


Any news about the second issue I mentionned, when the map contains only a ShapefileFeatureLayer as a DynamicLayer?


Nicolas



Nicolas,


Also, this one will be solved in the next release. Please see the attached sample code to see how to work around for now. Sorry for the inconvenience and any more queries please let us know.


Ben



137-4800ForNicolas.zip (4.68 KB)