Spatial reference must match map's spatial reference

6126
10
04-23-2013 08:35 PM
ReneRubalcava
Frequent Contributor
Using AGS SL API 3.1
I'm at a loss on this one.
My map has a TileMapServiceLayer, couple of Dynamic Layers and a couple of FeatureLayers.
The FeatureLayers URL sources are set before the map loads
All layers are from the same server and have the same spatial reference.
I set the URLs of the FeatureLayers via a resource, and load Dynamic layers when the app starts.
I manually set my extent to be safe.
<esri:Map x:Name="Map" Background="{StaticResource BaseColor}">
    <esri:Map.Extent>
        <esri:Envelope XMin="number" YMin="number" XMax="number" YMax="number" >
            <esri:Envelope.SpatialReference>
                <esri:SpatialReference WKID="102696"/>
            </esri:Envelope.SpatialReference>
        </esri:Envelope>
    </esri:Map.Extent>
    ...


Even if I just slightly pan the map, I get the attached error.
[ATTACH=CONFIG]23734[/ATTACH]

I'm lost on how to handle this. It says to clear the map layers. What?

If I could even figure out where to handle the error, I'd attempt to catch it and see if I could ignore it.

I stripped everything down to just a single TiledMapServiceLayer and the error still persists.

Any help would be greatly appreciated, thanks.
0 Kudos
10 Replies
ReneRubalcava
Frequent Contributor
I forgot to mention these are all secured services if it matters. Credentials manually added to the IdentityManager.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
The error means that your tiled layer doesn't match your map spatial reference.
You set manually the map spatial reference to WKID 102696 and likely your tiled layer is not using this one.
Do you get the same error if you don't set the map extent?
0 Kudos
ReneRubalcava
Frequent Contributor
This is what is set in the map service page for my basemap.
Format: JPEG
Compression Quality: 55.0
Origin: X: -1.76271E7 
Y: 1.97986E7 
Spatial Reference: 102696  (102696) 


All my other map services have
Spatial Reference: 102696  (102696)

If I remove the extent values, I still get the error. I tried changing to a web mercator basemap, same error.
0 Kudos
by Anonymous User
Not applicable
Hi All,

Did you get to solve this issue? I am having the same issue. My data is in WKID 28600. I have added the feature layers from Mapservice. When I pan the map I get the same error. Can anyone please help me. Thanks.

Arun
0 Kudos
DominiqueBroux
Esri Frequent Contributor
I would need more info about your config.

Normally if your services are hosted by ArcGIS server, they should be automatically projected in your map spatial reference.
What is the spatial reference of your map? Did you set manually (code or XAML) an extent?
0 Kudos
by Anonymous User
Not applicable
I would need more info about your config.

Normally if your services are hosted by ArcGIS server, they should be automatically projected in your map spatial reference.
What is the spatial reference of your map? Did you set manually (code or XAML) an extent?


Hi Dominique.

Thanks for the quick response. I have been fighting with this issue since 3 days and could not find a resolution. Below is the outline of what I have done.

Published the service using ArcGIS Server (Featureserver)
Added the service to the silverlight application via code and initialized.
On initialization, I have created featurelayers and added to the map.
I have lot other functinalities (Query, select, Edit, etc) and have the code in it.
It works as expected if I add a ArcGIS online baselayer to my map and all other layers take the same sref.
But when I not the baselayer, Map takes the service sref and do layers. But now when I pan, I get this error immediately.
I even tested just having my service & arcgis online service added to my map. Same error.

Now I have done this, I am pretty sure that it is something in the code which causes this and not to do with the service. When I debug the code executes through the "Map_ExtentChanged" event and then crashed with the error. Do you have any idea why?

Arun
0 Kudos
by Anonymous User
Not applicable
I would need more info about your config.

Normally if your services are hosted by ArcGIS server, they should be automatically projected in your map spatial reference.
What is the spatial reference of your map? Did you set manually (code or XAML) an extent?


Dominique,

My map sref is 28600 (Qatar National Grid). I did not set any extent to map in code or xaml. Should I set any?

Arun
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Dominique,

My map sref is 28600 (Qatar National Grid). I did not set any extent to map in code or xaml. Should I set any?

Arun


No at first glance, you don't need to set an extent.
It's still unclear for me what are the layers inside your map and your is exactly your issue.
0 Kudos
by Anonymous User
Not applicable
No at first glance, you don't need to set an extent.
It's still unclear for me what are the layers inside your map and your is exactly your issue.


Hi Dominique,

Thanks for the reply. Finally I was able to overcome the issue last night. The problem is still unknown to me but I have created a new silverlight project using the VS 2010 template and moved all my code modules into the new project. The error is no more. I have earlier used the standard.zip project downloaded from ESRI silverlight templates site (http://help.arcgis.com/en/webapi/silverlight/samples/TemplateGalleryWeb/start.htm) and started building my project. That still has this issue. It works fine as long as the Baselayer is loaded to map. If we remove the baselayer, just panning the map raises this exception of Invalid spatial reference. Might be of some help for you to look into and fix the template. If you need more information, will be glad to provide you with. Thanks.

Arun
0 Kudos