This is a migrated thread and some comments may be shown as answers.

Pushpin image not drawn in correct location

2 Answers 216 Views
Map
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 12 Mar 2010, 09:21 PM

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 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 16 Mar 2010, 12:39 PM
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.
0
Scott
Top achievements
Rank 1
answered on 16 Mar 2010, 06:11 PM
Thanks! The pushpins now behave as expected.

Scott
Tags
Map
Asked by
Scott
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Scott
Top achievements
Rank 1
Share this question
or