can't show webmap by id

907
7
10-24-2012 02:42 AM
JonGarrido
New Contributor III
Hi,

I don't understand why my arcgis online webmap is not reacheble form silverlight api. I have no problem form javascript.

The public url is http://bit.ly/XefMWI and de global id is 91e96980db394b039615871482752596

I can't load it even in the arcgis example to do that http://resources.arcgis.com/en/help/silverlight-api/samples/start.htm#LoadWebMapDynamically

The status of the map is public.

Any idea?

Thanks a lot in advance,

Jon Garrido
0 Kudos
7 Replies
DominiqueBroux
Esri Frequent Contributor
It seems there is an issue in the ArcGIS API for SL when displaying this webmap.
We'll try to get that fixed ASAP.

Thanks for reporting that issue.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
The workaround may be to add the webmap layers one by one instead of adding them as a collection.

So instead of code like:

LayerCollection layerCollection = new LayerCollection();
foreach (Layer layer in a.Map.Layers)
  layerCollection.Add(layer);

a.Map.Layers.Clear();
MyMap.Layers = layerCollection;


use:
var layers = a.Map.Layers.ToArray();
a.Map.Layers.Clear();
foreach(var layer in layers)
  MyMap.Layers.Add(layer);
0 Kudos
JonGarrido
New Contributor III
Hi,
Thanks a lot.
Using javascript there is no problem loading de map. I have it her http://jonhost.linuxd.org/mastergis/javascript/ (the call is in layaout.cs).

But using SL API it's no posible.

Thank you in advance agail.
0 Kudos
JonGarrido
New Contributor III
Sorry, I forgot to show my code...


The code of de SL connecition it's just the code of the arcgis.com example. Here it is:

xml code:

<UserControl x:Class="Mastergis.MainPage"
    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/client/2009">
    <Grid x:Name="LayoutRoot" >

    </Grid>

</UserControl>


And de C# code behind:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ESRI.ArcGIS.Client.WebMap;

namespace Mastergis
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();

            Document webMap = new Document();
            webMap.GetMapCompleted += webMap_GetMapCompleted;

            webMap.GetMapAsync("91e96980db394b039615871482752596");
        }

        void webMap_GetMapCompleted(object sender, GetMapCompletedEventArgs e)
        {
            if (e.Error == null)
                LayoutRoot.Children.Add(e.Map);
        }    
    }

}
            //this webmaps doesn't work a2748bd0100f4561b4f6293041655d36  91e96980db394b039615871482752596
            // this, the one of the arcgis.com examples, works fine... d5e02a0c1f2b4ec399823fdd3c2fdebd
       

Thank you very much again,

Jon Garrido,
0 Kudos
JonGarrido
New Contributor III
Hi again,

I have been triying many things for a while (a long while)... and I have found out the solution for me. Maybe somebody knows the reason and can show it to me.

When you turn off the make editable option you can load the webmap using JS API and also using SL API.

When any of the operational layers has editable option turned on you can't load webmap using SL API. Yes you can using JS API!!!

I don't know the reason....


Thank you very much again...
0 Kudos
CarlosCanas1
New Contributor
Hola Jon,

I�??m stuck in the same problem. I can�??t show my webmap by id using the Silverlight API, nevertheless I can show yours, the 91e96980db394b039615871482752596 about �??Cotos de pesca en Castilla y León�?�.

I�??m using just the code of Arcgis.com example as you did. My map�??s satatus is public and the �??make editable option�?� is turned off.
I�??d like to know if I did something different to what you did.

I created the shapefile with ArcMap 10.0, I uploaded the webmap with a zip. file, I changed the symbols and add a topographic basemap. (I digitalized my map with BingMaps as base map but I know I need some keys and token if I want to show BingMaps in my application, so I put an Arcgis.com basemap. I don�??t really care if my webmap doesn�??t fit with the base map right now).

The the webmap works fine in arcgis.com:
http://bit.ly/TGGjZ5

I don�??t know how to use JS so I have only tried with SL API.
Any idea?

Muchas gracias por adelantado!
0 Kudos
JonGarrido
New Contributor III
Hola Carlos,

I've tried your webmap (ID d21f82d1aab64fa2bdc74504c2c60033) and is reachable using JS. You can see it in http://www.jongarrido.es/tmp

I really don't know why it doesn't work using SL.

I suppose you are spanish speaker so feel free to contact me by email in spanish (contact info at www.jongarrido.es)

Any idea there?

In my case the problem was solved by cheking out the editable option of the layer, but in Carlos'es case it dosen't work.

Thank you very much to all,


Jon
0 Kudos