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 Reply Children