Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
335
Getting Started
posted

Hi.

I want to display some shape files using silverlight. I wanted to use xamMap or xamWebMap. btw. what is the difference between those two? I coulnd find xamWebMap control anywhere in the toolbox (i'm using trial version if that helps) but I did found xamMap so I tried with that. Where can I find some instructions on how to start? I found gazzillion examples for xamWebMap but none for xamMap. For the beggining I want to just load simple shp file from the local disc. And also what do I have to do to use xamWebMap?

Parents
  • 335
    posted

    I found documentation.

    but now I have whole different set of issues.

    1. How do you clear loaded shape file from the xamMap. I load your usa_pl as layer 1. then later I want to delete it with xamMap.Layers.Clear(); Map stops beeing interactive but image of use still remains visible.

    2. I have shape file converted from the AutoCad that simply won't display. I get no loading error. I assume its some kind of problem with coordinates.

  • 3255
    Verified Answer
    posted in reply to Hrvoje

    Hi grabah,

    XamWebMap was changed to XamMap, please take a look at this page for full list of 2010.2 breaking changes: http://help.infragistics.com/Help/NetAdvantage/DV/2011.1/CLR4.0/html/Breaking_Changes_2010_Volume_2.html

    About issue #1 - That seems like a bug that we have recently fixed, please apply the latest service release, for more information about SR take a look at: http://ko.infragistics.com/support/service-releases.aspx#ServiceReleases. After layers are removed you can set the new map's WorldRect with the following snippet:

    <pre>

    private void InitMapCoordinates()
    {
     // define world dimensions
     Point worldTopLeft = new Point(-180, 90);
     Point worldBottomRight = new Point(180, -90);

     // Convert Geodetic to Cartesian coordinates
     Point winTopLeft = this.xamMap.MapProjection.ProjectToMap(worldTopLeft);
     Point winBottomRight = this.xamMap.MapProjection.ProjectToMap(worldBottomRight);
     // Create Rect structure the map control's WindowRect and WorldRect
     Rect winRect = new Rect()
     {
      X = Math.Min(winTopLeft.X, winBottomRight.X),
      Y = Math.Min(winTopLeft.Y, winBottomRight.Y),
      Width = Math.Abs(winTopLeft.X - winBottomRight.X),
      Height = Math.Abs(winTopLeft.Y - winBottomRight.Y)
     };
     this.xamMap.IsAutoWorldRect = false;
     this.xamMap.WindowZoomMaximum = 40;

     // Change the map control's WindowRect and WorldRect
     this.xamMap.WindowRect = this.xamMap.WorldRect = winRect;
    }

    </pre> 

    About issue #2 -Please check the shapefile's prj file which contains coordinate system and projection information.

    Regards,

    Ivan Kotev

Reply Children