Pushpin image not drawn in correct location

3 posts, 0 answers
  1. Scott
    Scott avatar
    7 posts
    Member since:
    Jan 2010

    Posted 12 Mar 2010 Link to this post

    I'm using the RadMap control for an address location project. From a list, the user selects an address (lat, lon) and a Bing map is centered in the RadMap control. This works just fine. The map is drawn with the selected address centered in the RadMap control.

    Now, I want to add a pushpin at the address location. Using the code below, my image is inserted but not at the correct location. The center of the 16x16 pushpin is actually the upper left corner of the RadMap control. The pushpin needs to be in the center (at least initially) of the RadMap. If the user zooms and/or pans, the pushpin also needs to pan/zoom in order to show the selected address.

    This does not appear to an issue with screen coordinates vs. geographic coordinates. The upper left corner of the RadMap is 300,400 and the geographic coords are +45 (N), -90 (W). If I move the RadMap around in design and run the app again, the pushpin is always in the upper left corner.

    What am I doing wrong?

    Thanks,
    Scott

     

     

                radMap1.Provider = new BingMapProvider(MapMode.Road, true, BingMapsKey);  
                radMap1.Center = new Location(selectedResult.Latitude, selectedResult.Longitude);  
                radMap1.ZoomLevel = 15;  
     
     
                MapPinPoint pinPoint = new MapPinPoint()  
                {  
                    Background = new SolidColorBrush(Colors.White),  
                    Foreground = new SolidColorBrush(Colors.Red),  
                    FontSize = 14,  
                    ImageSource = new BitmapImage(new Uri(@"C:\Users\XXX\Desktop\location_16x16.png", UriKind.Absolute))  
                };  
     
                  
     
                MapLayer.SetLocation(pinPoint, new Location(selectedResult.Latitude, selectedResult.Longitude));  
                  
                InformationLayer layer = new InformationLayer();  
                layer.Items.Add(pinPoint);  
                radMap1.Items.Add(layer); 

     

  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 16 Mar 2010 Link to this post

    Hi Scott,

    When you add InformationLayr to map control form the code behind RadMap doesn't set MapControl property for it (i.e. the layer is not bound to map) automatically.
    We will fix this problem in the 2010.Q1 SP1.
    As workaround you can use the following code for link the map to the later:
    layer.MapControl = radMap1;

    Sincerely yours,
    Andrey Murzov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Scott
    Scott avatar
    7 posts
    Member since:
    Jan 2010

    Posted 16 Mar 2010 Link to this post

    Thanks! The pushpins now behave as expected.

    Scott
Back to Top