×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Mar 2014
    Posts
    4

    Maps and WP Toolkit pushpins issue

    Hello,

    I'm having an issue with placing pushpins on my map control. Every time I start pinching to zoom the pushpins start shifting.
    You can see this in the following screenshots (I'm zooming in, you can see the blue pushpin moves across the street):




    This is the code I use
    Code:
    MapLayer newMapLayer = new MapLayer();
               
                foreach (var item in context.NearbyParkings)
                {
                    //Assemble pushpin
                    StackPanel pinContent = new StackPanel { Orientation = System.Windows.Controls.Orientation.Horizontal};
                    TextBlock tb = new TextBlock { Text = item.name};
    
                    Image icon = new Image
                    {
                        Width = 25,
                        Height = 25,
                        Margin = new Thickness(0, 0, 5, 0),
                        Source = new BitmapImage(new Uri("/Images/Icon.png", UriKind.Relative))
                    };
    
    
                    if (item.carambla) pinContent.Children.Add(icon);
                    pinContent.Children.Add(tb);
    
                    //Pushpin
                    Pushpin newPushPin = new Pushpin()
                    {
                        Content = pinContent,
                        Tag = item,
                        //GeoCoordinate = mapMain.Center
                    };
                    newPushPin.Tap += pushPinTapEvent;
    
                    //Set colour
                    if (item.hasFreeSpots)
                    {
                        newPushPin.Background = new SolidColorBrush(Color.FromArgb(200, 16, 191, 3));
                    }
                    else
                    {
                        newPushPin.Background = new SolidColorBrush(Color.FromArgb(200, 221, 68, 0));
                    }
    
                    if (!item.hasAvailabilityInfo) newPushPin.Background = new SolidColorBrush(Color.FromArgb(200, 2, 132, 220));
    
                    //Place layer
                    MapOverlay pushOverlay = new MapOverlay()
                    {
                        Content = newPushPin,
                        GeoCoordinate = new GeoCoordinate(item.latitude, item.longitude),
                    };
                    
                    
                    newMapLayer.Add(pushOverlay);
    
                }
                //Add layer to map
                mapMain.Layers.Add(newMapLayer);
    My XAML
    Code:
    <maps:Map x:Name="mapMain" LandmarksEnabled="True" Margin="0,0,0,30" Height="411" ViewChanged="mapMain_ViewChanged" CenterChanged="mapMain_CenterChanged"/>
    How can I fix the shifting issue?

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: Maps and WP Toolkit pushpins issue

    You would need to work with the PositionOrigin : http://msdn.microsoft.com/en-us/libr...ionorigin.aspx

    As you can see its now set to 0,0, which means that the uppper left corner stays in place, while other parts are shifting when zooming

  3. #3
    Registered User
    Join Date
    Mar 2014
    Posts
    4

    Re: Maps and WP Toolkit pushpins issue

    Isn't it set by default in the bottom left corner?
    I tried various combinations by nothing works
    Code:
    Pushpin newPushPin = new Pushpin()
                    {
                        Content = pinContent,
                        Tag = item,
                        PositionOrigin = new Point(0,-1)
                    };

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: Maps and WP Toolkit pushpins issue

    Try 0,1, as you can see from your own images, the default is 0,0, which is the upper left corner.

  5. #5
    Registered User
    Join Date
    Mar 2014
    Posts
    4

    Re: Maps and WP Toolkit pushpins issue

    I tried, I also tried using it on the MapOverlay. Neither worked, it still acts the same

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: Maps and WP Toolkit pushpins issue

    Then unfortunately I'm out of ideas for it.

  7. #7
    Regular Contributor
    Join Date
    Jun 2013
    Posts
    53

    Re: Maps and WP Toolkit pushpins issue

    Vixez... I've a similar running project. Worked with styles in xaml to define the pushpins. Bit difficult to put that complete code here, but ping me on twitter @depechie - so we can exchange emails - I'll mail you example!

  8. #8
    Registered User
    Join Date
    Mar 2014
    Posts
    4

    Re: Maps and WP Toolkit pushpins issue

    Quote Originally Posted by Depechie View Post
    Vixez... I've a similar running project. Worked with styles in xaml to define the pushpins. Bit difficult to put that complete code here, but ping me on twitter @depechie - so we can exchange emails - I'll mail you example!
    Thanks, I've contacted you on Twitter!

  9. #9
    Nokia Developer Champion
    Join Date
    Sep 2012
    Location
    Morocco
    Posts
    297

    Re: Maps and WP Toolkit pushpins issue

    Using Pushpin you don't have to change anything regarding the PositionOrigin.
    but using MapOverlay from a look at your Pins' examples you'll have to use "PositionOrigin = new Point(0, 1)".
    Could you please post the xaml code of the Pin you made for the MapOverlay?

Similar Threads

  1. Porting Google Maps v2 to HERE Maps -> Error initializing map: problem with disk cach
    By soucecastle in forum Nokia X Announcements and Feedback
    Replies: 6
    Last Post: 2014-02-28, 13:58
  2. OVI maps API issue
    By vineet.jain in forum Symbian
    Replies: 6
    Last Post: 2011-04-27, 21:08
  3. Is there a way to convert Maps Data from Nokia Maps 3 to be compatible with N Maps 2
    By dimchopicha in forum General Development Questions
    Replies: 6
    Last Post: 2011-01-09, 17:50
  4. Replies: 2
    Last Post: 2010-03-02, 18:34

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×