Add In Bookmark Example.

3510
12
04-25-2012 10:15 AM
deleted-user-yA_w_FC9FKe5
New Contributor III
So I want to try and use the bookmarks add-in.  I downloaded the sample and then tried to add it into my page using the settings/add-ins but that did not seem to work.  So I saw something about having to compile or something.  So I opened it up in VS 2010 and noticed right away I had some reference errors with the esri assemblies.  So I just added those in using the Project/Add Reference/Browse (ex C:\Program Files (x86)\ESRI SDKs\Silverlight\v2.4\ESRI.ArcGIS.Client.Toolkit.dll).

Now I get one on system.windows.interactivity.  I tried to add it like the others but it was not located in the ("C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\") like System.Windows.Browser.dll was.  I did a search for that dll and found it (Expressions) and placed it in the folder but VS 2010 does not like it because I moved it.   So then I took it out thinking I might not need it and now get a bunch of errors.

So what all am I doing wrong here.  Obviously I am a newbie at this.
0 Kudos
12 Replies
deleted-user-yA_w_FC9FKe5
New Contributor III
Hi Michael,

From our help:

You won't be able to edit the Tools.xml file directly to add the bookmarks; instead, you'll need to write some code on your end to allow entering of coordinates. (Enter coordinates, zoom to location, create bookmark, etc.). 🙂

Katy


Thanks Katy but this takes the level of ease from about a 3 to about a 9 😞  Not exactly what we were shooting for with the Viewer application.  As reference I was able to do this pretty easiliy with the Flex Viewer Application.  With just this line of code that got created in ArcGIS.  <bookmark name="Arizona">-112.38977 30.7464496467391 -106.38002 36.2270803532609</bookmark>.  This is such a great application but in a couple of areas just disappoints.  Creating bookmarks is a basic functionality.
0 Kudos
RichZwaap
Occasional Contributor III
Hi Michael:

Here's the process for creating a Viewer containing the tool and editing bookmarks in the config file.


  1. Don't use Visual Studio and the Viewer template (i.e. the sample from the SDK).  Use the Application Builder.  The template is for developing your own add-ins.  You are not doing that here, but rather just looking to load, configure, and use an existing example.

  2. Download the pre-compiled xap containing the Bookmarks tool from here.

  3. Open the Application Builder

  4. Upload the pre-compiled add-in to Application Builder

  5. Create a new Viewer application

  6. Add the Bookmarks tool using the Add Tool button on the Tools tab

  7. In the Bookmarks configuration, the last page is for defining bookmarks.  The tool is designed for you to add bookmarks interactively at this point, by defining a name, zooming/panning to the desired bookmark extent, and clicking Add.  In your case, since this does not work for your existing workflow, input a dummy bookmark and click OK

  8. Deploy the application

  9. Navigate to the folder containing the deployed app on disk.  With default installations of IIS and the Viewer, this would be c:\inetpub\wwwroot\apps\<app name>

  10. Navigate to the config folder.  This contains Tools.xml and the other Viewer configuration files

  11. Open the Tools.xml file and find the Bookmarks tool.  It sounds like you already found this in the Tools.xml file in the Viewer template - it will look the same here as well.

  12. Replace the dummy bookmark with your set of bookmarks.  You had the right format in your previous post.  So the whole tool's markup should look something like this:

  13. <Tool Label="Bookmarks" Icon="/Bookmarks.AddIns;component/Images/Bookmark16.png" Description="View bookmarks in the map">
        <Tool.Class>
            <Bookmarks_AddIns:BookmarksTool />
        </Tool.Class>
        <Tool.ConfigData>
            <ArrayOfBookmark.MapBookmark xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Toolkit">
    
                <!-- First Bookmark -->
                <Bookmark.MapBookmark>
                    <Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
                    <d3p1:spatialReference>
                        <d3p1:wkid>102100</d3p1:wkid>
                    </d3p1:spatialReference>
                    <d3p1:xmax>-5753581.5</d3p1:xmax>
                    <d3p1:xmin>-15499612</d3p1:xmin>
                    <d3p1:ymax>7454065.7724409448</d3p1:ymax>
                    <d3p1:ymin>1890386.9437007876</d3p1:ymin>
                    </Extent>
                    <Name>Test</Name>
                </Bookmark.MapBookmark>
    
                <!-- Second Bookmark -->
                <Bookmark.MapBookmark>
                    <Extent xmlns:d3p1="http://schemas.datacontract.org/2004/07/ESRI.ArcGIS.Client.Geometry">
                        <d3p1:spatialReference>
                            <d3p1:wkid>102100</d3p1:wkid>
                        </d3p1:spatialReference>
                        <d3p1:xmax>-4754581.5</d3p1:xmax>
                        <d3p1:xmin>-14499612</d3p1:xmin>
                        <d3p1:ymax>7454065.7724409448</d3p1:ymax>
                        <d3p1:ymin>1890386.9437007876</d3p1:ymin>
                    </Extent>
                    <Name>Test 2</Name>
                </Bookmark.MapBookmark>
            </ArrayOfBookmark.MapBookmark>
        </Tool.ConfigData>
    </Tool>

  14. Save and close Tools.xml

  15. Open Application.xml and increment the number contained in the <Version> tag.  This will keep users from needing to clear their browser cache to see the changes you make in the config file.


Hope this helps.
0 Kudos
deleted-user-yA_w_FC9FKe5
New Contributor III
Genius.  I knew that tools.xml had to do something.  Fantastic answer.  This should be helpful to many people.  Now one more small favor.  Since I have like 80 of these bookmarks created the box is really big on my screen.  How can I contain that?  I'm very excited about this. 

This is the sort of stuff that really needs to be taught in a GIS Silverlight Viewer Class at the conference.  Hint Hint.  I'm going to have to look at that apps folder a little more closely now.
0 Kudos