Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a wpf app with an ArcGIS map, I used the extent property to zoom and pan to Canada (the location I want) and added the pins (images) by adding a graphics layer, see code below.

currently I'm using this map: http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer

I'd like to use this instead: http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer

the problem is that the pins show up in the middle of the map, the 0,0 location, when I switch to the new map. Are graphics specific to a type of maps or am I adding graphics the wrong way? What's the best way to add images to map?

Thanks, T

<Grid x:Name="LayoutRoot">
    <Grid.Resources>
        <esri:PictureMarkerSymbol x:Key="PushPin"
                                  OffsetX="11"
                                  OffsetY="39"
                                  Source="pushpin.png" />
    </Grid.Resources>

    <esri:Map x:Name="MyMap"
              Extent="-125, 40, -60, 60">
        <esri:Map.Layers>
            <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
                                             Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
            <esri:GraphicsLayer>
                <esri:GraphicsLayer.Graphics>
                    <!-- Halifax -->
                    <esri:Graphic Symbol="{StaticResource PushPin}">
                        <esri:MapPoint X="-63"
                                       Y="45" />
                    </esri:Graphic>

                    <!-- Toronto -->
                    <esri:Graphic Symbol="{StaticResource PushPin}">
                        <esri:MapPoint X="-79.5"
                                       Y="44" />
                    </esri:Graphic>

                    <!-- Vancouver -->
                    <esri:Graphic Symbol="{StaticResource PushPin}">
                        <esri:MapPoint X="-123"
                                       Y="49.5" />
                    </esri:Graphic>
                </esri:GraphicsLayer.Graphics>
            </esri:GraphicsLayer>
        </esri:Map.Layers>
    </esri:Map>
</Grid>
share|improve this question
3  
If the map you are switching to has a webmercator spatial reference, the symbols would appear in the Atlantic. The url you've posted is for an unprojected mapservice. –  Kirk Kuykendall Jun 24 '11 at 17:34
    
Thanks, I wasn't familiar with the Web Mercator system. Was able to use Bing maps with ArcGIS/Esri. –  ErgonomicDeveloper Jun 27 '11 at 17:53
add comment

3 Answers

Your graphics coordinates appear to be WGS 1984 or spatial reference 4326 so does your extent. You are trying to switch to a map service that is in Web Mercator which is spatial reference 102100.

Just go to this link and look at the coordinates at the bottom and you can see they are different.

http://help.arcgis.com/en/webapi/javascript/arcgis/demos/map/map_currentextent.html

The above link uses the map service you want to switch too. So you need to convert your coordinates from spatial reference 4326 (WGS 1984) to spatial reference 102100 (Web Mercator).

share|improve this answer
add comment

Does This Help?
ESRI Resource Center

share|improve this answer
    
That's the javascript resource center and I'm using wpf. Also, I've already checked the wpf resource center, there's no mention of the type of maps that graphics work with, in fact I'm using the map in their example. –  ErgonomicDeveloper Jun 24 '11 at 16:57
add comment

The Map will get the spatial reference from the first added layer. From the documentation:

By default, the initial extent is the full extent of all layers in the map. The spatial reference is defined by the first layer with a spatial reference in the layer collection.

So make sure you get a specific Spatial Reference set the Extent property on the Map. See the part "Defining a spatial reference for the map" in the documentation.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.