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
Hello Ahrensd,
I am just checking if you require any further assistance on the matter.
Hello,
Thank you for your feedback. I have been looking into your new question and I can suggest you look into the following forum thread :
http://ko.infragistics.com/community/forums/t/53321.aspx
where Ivan has provided a sample application(1588.XamMapSample.rar) that shows how to use the SqlShapeReader.
Please let me know, if you need any further assistance on this matter.
Thanks for the post,
What it turned out to be was that I (through the use of the code above) was over writing the ShapefileReader object set in the Xaml code. Therefore all my testing of projections did nothing.
So now I need to change the ShapefileReader to SQLReader and try to bind the colour to a attribute, so that when the attribute changes the colour changes.
Love some ideas or code to help me along!!!
Hi ahrensd,The code you have provided in your post is working correctly if the Uri of the ShapeFileReader is set to point at the shapefiles you attached in one of your previous posts. I assume that the issue you are facing is related to the actual loading of the shapes and not to the projection.Hope this helps,Milana Zhileva
Thank you for your reply, but I've tried various attempts around projection with no success?
tried tighter definition too.
<ig:ShapeFileReader DataMapping="Name=LABEL; Caption=LABEL; Value=stock">
<ig:ShapeFileReader.CoordinateSystem>
<ig:CoordinateSystem FalseEasting="0.0" FalseNorthing="0.0" UnitType="M">
<ig:CoordinateSystem.Projection>
<ig:Mercator EllipsoidType="WGS84" CentralMeridian="0.0"/>
</ig:CoordinateSystem.Projection>
</ig:CoordinateSystem>
</ig:ShapeFileReader.CoordinateSystem>
</ig:ShapeFileReader>
Did you get it to work?
I've attached the property dialogs from ArcGIS of the to shape files showing their projection properties.
I'm starting to think this could be a bug in your control, that it can't change to this projection?