none
how to place custom image push pin on map with image height and width? RRS feed

  • Question

  • how to place custom image push pin on map with image height and width but do not allow to move image on map from one place to another but it should be static on given longitude and latitude.
    Saturday, March 22, 2014 5:43 AM

Answers

  • When the map moves the latitude/longitude position moves. Do you want the image to stay with the proper coordinates or just float above the map and not be related to the coordinates? If you what the image to stay linked to the coordinate then do this:

    Image img = new Image();
    img.Source = new BitmapImage(new Uri(“ms-appx:/Assets/Logo.png”));
    
    MapLayer.SetPosition(img, MyMap.Center);
    MyMap.Children.Add(img);

    If you want the image to float above the map and not be linked to it's coordinates but stay in the same place on the screen then you can do this:

    Image img = new Image();
    img.Source = new BitmapImage(new Uri(“ms-appx:/Assets/Logo.png”));
    
    Windows.Foundation.Point p;
    MyMap.TryLocationToPixel(MyMap.Center, out p);
    Canvas.SetTop(img, p.Y);
    Canvas.SetLeft(img, p.X);
    MyMap.Children.Add(img);
    

    Also, take a look at my free ebook on creating location intelligence Windows Store apps. If shows how to do this and a lot more: http://rbrundritt.wordpress.com/my-book/


    http://rbrundritt.wordpress.com

    Monday, March 24, 2014 10:11 AM