I want to show ENC chart in my WPF app but getting these error. I have also attached screen shot of error. I have set symbols path and manifest file too but no success.
<Window x:Class="ArcGISApp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013" xmlns:hydro="clr-namespace:Esri.ArcGISRuntime.Hydrographic;assembly=Esri.ArcGISRuntime" Title="MainWindow" Height="350" Width="525"> <Grid> <esri:MapView x:Name="MyMapView" LayerLoaded="MyMapView_LayerLoaded"> <esri:Map> <!--<esri:ArcGISTiledMapServiceLayer ID="Basemap" ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>--> <esri:GroupLayer ID="Hydrographic"> <hydro:HydrographicS57Layer ID="PK2NB58Z" Path="US5TX51M.000"> </hydro:HydrographicS57Layer> </esri:GroupLayer> </esri:Map> </esri:MapView> </Grid></Window>
I think there is no issue at all in code. I dont understand what is the reason..........!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
It seems that cause here is setting MapView and Maps SpatialRefernce correctly. It is normally taken from the first layer but GroupLayer doesn't have one.
Here is code that should work
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN><SPAN class="namespace token">esri:</SPAN>MapView</SPAN> <SPAN class="attr-name token"><SPAN class="namespace token">x:</SPAN>Name</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>MyMapView<SPAN class="punctuation token">"</SPAN></SPAN> <SPAN class="attr-name token">LayerLoaded</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>MyMapView_LayerLoaded<SPAN class="punctuation token">"</SPAN></SPAN><SPAN class="punctuation token">></SPAN></SPAN> <SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"></</SPAN><SPAN class="namespace token">esri:</SPAN>MapView</SPAN><SPAN class="punctuation token">></SPAN></SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
<SPAN class="keyword token">using</SPAN> Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime<SPAN class="punctuation token">.</SPAN>Controls<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">using</SPAN> Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime<SPAN class="punctuation token">.</SPAN>Geometry<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">using</SPAN> Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime<SPAN class="punctuation token">.</SPAN>Hydrographic<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Diagnostics<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Windows<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">namespace</SPAN> HydragraphicLayersDemo <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">partial</SPAN> <SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">MainWindow</SPAN> <SPAN class="punctuation token">:</SPAN> Window <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">private</SPAN> HydrographicS57Layer _layer<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">public</SPAN> <SPAN class="token function">MainWindow</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="token function">InitializeComponent</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// Force to use WebMercator which is normally taken from the first layer</SPAN> <SPAN class="keyword token">var</SPAN> map <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Map</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> SpatialReference <SPAN class="operator token">=</SPAN> SpatialReferences<SPAN class="punctuation token">.</SPAN>WebMercator<SPAN class="punctuation token">,</SPAN> InitialViewpoint <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ViewpointExtent</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Envelope</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN> SpatialReferences<SPAN class="punctuation token">.</SPAN>WebMercator<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// Create hydrographic layer and set it to the layers collection</SPAN> _layer <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">HydrographicS57Layer</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> ID <SPAN class="operator token">=</SPAN> <SPAN class="string token">"US1WCO1M"</SPAN><SPAN class="punctuation token">,</SPAN> Path <SPAN class="operator token">=</SPAN> <SPAN class="string token">@"C:\Temp\HydragraphicLayersDemo\HydragraphicLayersDemo\bin\Debug\us1wc01m\US1WC01M.000"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN> map<SPAN class="punctuation token">.</SPAN>Layers<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Add</SPAN><SPAN class="punctuation token">(</SPAN>_layer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// Set map to view</SPAN> MyMapView<SPAN class="punctuation token">.</SPAN>Map <SPAN class="operator token">=</SPAN> map<SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// Zoom to the layer when the layer is loaded</SPAN> <SPAN class="token function">ZoomToHydrographicLayers</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">async</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">ZoomToHydrographicLayers</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">try</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">// wait until all layers are loaded</SPAN> <SPAN class="keyword token">await</SPAN> MyMapView<SPAN class="punctuation token">.</SPAN><SPAN class="token function">LayersLoadedAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> Envelope extent <SPAN class="operator token">=</SPAN> _layer<SPAN class="punctuation token">.</SPAN>FullExtent<SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// Zoom to full extent</SPAN> <SPAN class="keyword token">await</SPAN> MyMapView<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetViewAsync</SPAN><SPAN class="punctuation token">(</SPAN>extent<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">catch</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="token class-name">Exception</SPAN> ex<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> MessageBox<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Show</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Error occurred : "</SPAN> <SPAN class="operator token">+</SPAN> ex<SPAN class="punctuation token">.</SPAN>Message<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Sample error"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">MyMapView_LayerLoaded</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">object</SPAN> sender<SPAN class="punctuation token">,</SPAN> LayerLoadedEventArgs e<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>e<SPAN class="punctuation token">.</SPAN>LoadError <SPAN class="operator token">==</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">return</SPAN><SPAN class="punctuation token">;</SPAN> Debug<SPAN class="punctuation token">.</SPAN><SPAN class="token function">WriteLine</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">string</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">Format</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Error while loading layer : {0} - {1}"</SPAN><SPAN class="punctuation token">,</SPAN> e<SPAN class="punctuation token">.</SPAN>Layer<SPAN class="punctuation token">.</SPAN>ID<SPAN class="punctuation token">,</SPAN> e<SPAN class="punctuation token">.</SPAN>LoadError<SPAN class="punctuation token">.</SPAN>Message<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Hi, I hva eseen ur ArcGIS Runtime SDK for .NET: Tips and Tricks video but in the attached samples there is no demo project for funky symbols..!! Can u provide me that bcz we r stuck only in specialized symbols using ArcGIS. If u have any other samples or some tips for custom symbols plz provide us. Thnaks.
Thanks. We also have contacted our local distributor but still confused about licensing.
As soon as we are exploring many things are coming to mind..is it possible to combine two maps such as loading tpk file and then ENC?
I did but as soon as I zoom to hydro layer the loaded tpk disappears. I tried to merge both but got error "Mix spatial references are not supported". Any suggestion?
You can work with GraphicsOverlays (On top of MapView.Map.Layers preferred way) or using GraphicsLayers (inside of MapView.Map.Layers collection) to add custom object to the MapView. Have a look samples in https://github.com/Esri/arcgis-runtime-samples-dotnet/tree/master/src/Desktop/ArcGISRuntimeSamplesDesktop/Samples/GraphicsLayers
Sorry for the late reply...As I asked previously can I add custom drawing in charts?
Is there any page where I can see what can I do and what not?
You can contact your distributor for the licensing. Also have a look to licensing documentation.
Yes I knew that .NET sdk has been overhauled and already explored a bit. As to samples, I hate when any sample on net use NuGet package and myself is uncomfortable with it. I have downloaded right samples, first I was missing data folder which again downloaded n then the package error; mean unable to get it removed from solution.
Actually what I need in my app is that I just need to show ENC charts (.000). Do I need to be online to show this? I have attached the error screen shot in question and the code is also pasted there. Once I uncomment the line
<!--<esri:ArcGISTiledMapServiceLayer ID="Basemap".....
I dont get any error but I have to be online to show the map. I dont need this map, I have S57 ENC files and want to show these maps.
At the moment I have no urgency of compiling samples but we are exploring few SDKs and this is obviously seem to be the best. We have good experience in .NET and WPF. I m not understanding what is wrong as why I m unable to get the ENC charts rendered. If u can provide me with a separate sample to show ENC files offline, it would help us a lot as our app will always be in disconnected mode....
If there is still anything u need to explain me, let me know plz.
Why there is difference in using sdk for .net and sdk for wpf?
Just to clarify that ArcGIS Runtime for .NET and ArcGIS Runtime for WPF are 2 different SDKs. ArcGIS Runtime for WPF is older SDK that is replaced by ArcGIS Runtime for .NET (which contains SDKs for WPF, Windows Store and Windows Phone). ArcGIS Runtime for .NET API has been redesigned and modernized which means that the API is not the same as the old one.
Can u suggest any other to do or is there any complete sample available? the samples available to download are not compiling.......
Could you post which samples you are building? If you are using ArcGIS Runtime for .NET you should be using this repository. It has couple samples that uses hydrographic layer. Make sure that you follow these steps to get the reference changed so you can deploy the files. Could you paste compile error information too?
Yes .dat file is placed in both locations. Now I have commented symbols path and getting the error "failed to load cell info".
Why there is difference in using sdk for .net and sdk for wpf? I have also seen examples for wpf sdk n these work in totally different way as we can embed the S57Cell object inside HydrographicS57Layer. First time I m using ArcGIS sdk for .net and have never used any previous versions and also not used sdk for wpf.
Hi,
It sounds like the hydrographic_s57.dat file cannot be found. If you are running the app on your dev machine against the installed SDK then it should be in "C:\Program Files (x86)\ArcGIS SDKs\DotNet10.2.7\WindowsDesktop\bin\arcgisruntime10.2.7\resources\symbols\hydrographic_s57". Or if you have added a deployment manifest to your and selected to include the hydrographic option then it should be in "<your_app_folder>\arcgisruntime10.2.7\resources\symbols\hydrographic_s57". You should not need to set the symbols path unless you have included the .dat file elsewhere in your app/solution.
Can you see the dat file in either of those locations?
Cheers
Mike
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.