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,
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.
Did get it to work after changing the shapefile to one with a lat long projection, I really would prefer to use the one with Web Mercator.
Ive attached both in the zip file.
What do I have to do the control.
Thanks
Thank you for your feedback. I have been looking into your requirements and if you would like to use a shape file with Web Mercator, you need to set the projection of the coordinate system like :
...
<igMap:MapLayer.Reader>
<igMap:ShapeFileReader Uri="/../../Shapefiles/Spyglass_Beef_research_Facility">
<igMap:ShapeFileReader.CoordinateSystem>
<igMap:CoordinateSystem>
<igMap:CoordinateSystem.Projection>
<igMap:SphericalMercator EllipsoidType="WGS84"/>
</igMap:CoordinateSystem.Projection>
</igMap:CoordinateSystem>
</igMap:ShapeFileReader.CoordinateSystem>
</igMap:ShapeFileReader>
</igMap:MapLayer.Reader>
</igMap:MapLayer>
For more information on this matter , you can look into the following forum thread where this has been already discussed :
http://es.infragistics.com/community/forums/p/55959/287069.aspx#287069
Let me know, if you need any further assistance on this matter.
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?
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
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!!!
Hello Ahrensd,
I am just checking if you require any further assistance on the matter.