Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
945
xamMap fails to show any spatial data
posted

I am trying to create a simple map based status screen.

Would like to link with current data with Entity data store. Then based on a field change the colour of the polygon.

Currently I can't get any display at all! (even trying a shapefile as well!)

Calling code is

SplashScreenMap map = new SplashScreenMap();

map.Extent = _mappingVM.CurrentMapExtent.ToLatLong();

SqlShapeReader sqlReader = map.XamMap.Layers["PaddockLayer"].Reader as SqlShapeReader;

if (sqlReader != null)

{

var data = ViewModel.ViewModelLocator.Report.PaddockDictShapes;

sqlReader.DataSource = data; map.XamMap.Layers["PaddockLayer"].ImportAsync();

}

ShapeFileReader shp = map.XamMap.Layers["PaddockShape"].Reader as ShapeFileReader;

if (shp != null)

{

shp.Uri = "file://" + System.IO.Path.Combine(Directory.GetCurrentDirectory(), _mappingVM.GetLayer(LayerType.Paddock).FeatureSet.Filename) .Replace(@"\", "/");

}

map.Show();

await Task.Delay(10000);

map.Close();

 

And the property I would like to bind to

 

 

public IEnumerable<Dictionary<string, string>> PaddockDictShapes

{    

get    

{        

if (_DictShapes == null)        

{            

List<string> props = Helpers.Utilities.GetProperties<ShapeData>();

_DictShapes = new List<Dictionary<string, string>>();            

foreach (ShapeData paddockShape in PaddockShapes)            

{                

Dictionary<string, string> valueDictionary = new Dictionary<string, string>();                

foreach (string prop in props)                

{                    

PropertyInfo propertyInfo = typeof(ShapeData).GetProperty(prop);                    

object value = propertyInfo.GetValue(paddockShape);                    

valueDictionary.Add(prop, (value == null) ? "" : value.ToString());                

}                

_DictShapes.Add(valueDictionary);            

}        

}        

return _DictShapes;    

}

}

and attached the Xaml file

 

Views.zip
Parents
  • 35319
    posted

    Hello,

     

    Thank you for contacting us. I have been looking into your issue and it seems that you major issue is that you cannot load the shape file correctly. I have been trying to isolate your scenario in sample application(MapLoadShapesWPF.zip) in order to show you how to load the shape file. Please try to run the sample application as only you need to change the ‘Uri’ of the shape file in order to meet your specific one.

     

    Let me know your results.

     

     

    MapLoadShapesWPF.zip
Reply Children