×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    6

    Maps Polygon Opacity (and Size) in WP8

    I'm trying to transfer an project from WP7 to WP8 (and therefore updating from Bing Maps to Nokia's).

    Originally I had bounded a map region based on a whole bunch(20) of GeoCoordinates which created a MapPolygon and then changed the Opacity property of the MapPolygon before adding it as a Child to the Map Control.

    As I'm trying to make the transition to Nokia's Map Control it seems to me that there is no way to specify the region of the Polygon I want created using GeoCoordinates.
    Which means that as I Zoom in and out on the map the Polygon stays the same shape on the screen.
    Surely there has to be a way to allow the Polygon to remain the same proportional size no matter if you zoom in/out?!?!?

    I know that Bing Maps can still be used so I tried implementing it, but because it is deprecated somebody thought it was a good idea to take away the Opacity property of their MapPolygon.

    Now I'm stuck in between a rock and a hard place... either I can't change/set the Opacity property(Bing) or else I have a Polygon which won't stay fixed on the map (Nokia).

    Any help would be greatly appreciated!

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

    Re: Maps Polygon Opacity (and Size) in WP8

    I think you have used something else than polygon, polygons are taking coordinates fro the points, so they stay same place all times.

    Anyway, I'm cleaning up my examples, will try getting them out today. Basically ported my old examples into the WP8 to see what the differences are. So you could see the same implementation with WP7/Qt/QtQuick/Java/Js examples I made earlier and the idea is to assist on porting..

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

    Re: Maps Polygon Opacity (and Size) in WP8

    Actually, it now public. You could find it from: http://projects.developer.nokia.com/WP8MapsExamples

    Let me know if you have issues with any codes, could try making wiki page for special issues.

  4. #4
    Registered User
    Join Date
    Nov 2012
    Posts
    6

    Re: Maps Polygon Opacity (and Size) in WP8

    You're right... I must be using something else or doing something incorrect.
    From what I can tell, we are using different namespaces and therefore different mapping systems.
    It looks like you are using Bing Maps and I'm using the new built in mapping system (Nokia).

    Here is my code to add a Polygon:

    //Creating a Polygon
    Polygon MyPolygon = new Polygon();


    MyPolygon.Points.Add(new Point(2, 0));
    MyPolygon.Points.Add(new Point(22, 0));
    MyPolygon.Points.Add(new Point(2, 40));
    MyPolygon.Stroke = new SolidColorBrush(Colors.Black);
    MyPolygon.Fill = new SolidColorBrush(Colors.Black);
    MyPolygon.SetValue(Grid.RowProperty, 1);
    MyPolygon.SetValue(Grid.ColumnProperty, 0);
    MyPolygon.Opacity = 0.5;

    //Adding the Polygon to the Grid
    //MyGrid.Children.Add(MyPolygon);

    //Creating a MapOverlay and adding the Grid to it.
    MapOverlay MyOverlay = new MapOverlay();
    MyOverlay.Content = MyPolygon;

    MyOverlay.GeoCoordinate = new GeoCoordinate(49.3393850118753, -0.4569707717895518);

    //MyOverlay.PositionOrigin = new Point(0.99, 0.99);

    //Creating a MapLayer and adding the MapOverlay to it
    MapLayer MyLayer = new MapLayer();
    MyLayer.Add(MyOverlay);

    map1.Layers.Add(MyLayer);


    I understand that I can add the Polygon to a Grid and then the Grid to the Overlay but that still won't solve the problem.
    But as you can see there is no way to add GeoCoordinates... only Points.
    Last edited by lfchockey; 2012-11-09 at 00:47.

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

    Re: Maps Polygon Opacity (and Size) in WP8

    Please check the Docs & examples, you are using MapOverlay and adding a polygon into it. And indeed map overlay objects are not sized accordingly.

    Instead you should use the map object Polygons, and you could check the code examples (f.ex. SimpleContent) i have in the link, its using the new API, and there is also link to old style projects, so you could see how indeed it was done with WP7. I think the API is generally the same, with just some naming changes there.

  6. #6
    Registered User
    Join Date
    Nov 2012
    Posts
    6

    Re: Maps Polygon Opacity (and Size) in WP8

    I have taken a look at the examples (specifically the Simple Map Content) but the example is not using the built in Map Control provided in Windows Phone 8.
    Instead it uses a different class/namespace which is connected to Bing Maps and not the built-in Nokia maps (which is what I would like to use).

    I've used the techniques displaced by the examples in the link you provided to program maps in WP7 but with the new release, and Microsoft's intent to transition mapping towards Nokia, I'd like to learn how to program the built in control. Especially since the Bing Maps are now deprecated and probably won't be supported in future releases.

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

    Re: Maps Polygon Opacity (and Size) in WP8

    Those codes are compiled with WP8 SDKs, they were originally using bing maps, but they were ported to use the new Maps API, thus these are not using Bing maps. I can not understand how would you see them using bing maps, can you specify me on what makes you think so ?

    So do check them out, and just try them out.

  8. #8
    Registered User
    Join Date
    Nov 2012
    Posts
    6

    Re: Maps Polygon Opacity (and Size) in WP8

    What makes me think you are using the Bing Maps control is that if I do a search for a specific part of the map using the code that you provided in the example, your maps match perfectly with what the maps look like on the actual Bing Maps (http://www.bing.com/maps/).
    On the other hand, if you use just the standard map that VS2012 provides inside the "Toolbox" I get the same map that Nokia provides with its Nokia Maps system.

    Also, the namespace you are using for the maps is different than the ones that are provided when you drop the control directly on a new WP8 page from the "Toolbox" in VS2012.
    Yours:
    using Microsoft.Phone.Controls;
    using Microsoft.Phone.Controls.Maps;
    (XAML) xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps" >

    Mine:
    using Microsoft.Phone.Maps.Controls;
    (XAML)xmlns:maps="clr-namespace:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps"

    The last thing is that when running your SimpleMapContent if I don't provide "Credentials" then I get the standard "Invalid Credentials ..." message splashed across the map. The link it provides goes directly to the Bing Maps sign-up.

    Thank you very much for working this out with me! I appreciate all of the help you are giving me!

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

    Re: Maps Polygon Opacity (and Size) in WP8

    I have no idea what you are talking about, if you check my codes you can very easily see using Microsoft.Phone.Maps.Controls;, so I would be really puzzled how your tools would have the old one used in there.. see the link to the code directly: http://projects.developer.nokia.com/...inPage.xaml.cs

    Also there is no credentials used in my code samples for WP8, so I have no idea what you are getting that from either.

    I suppose you should pay attention, and not follow the links for other platform examples, instead, just check the codes inside the project..

  10. #10
    Registered User
    Join Date
    Nov 2012
    Posts
    6

    Re: Maps Polygon Opacity (and Size) in WP8

    My sincere apologies symbianyucca!
    Apparently I was looking at code you had made for the WP7 and downloaded the incorrect project.

    I'm currently going through your examples and I'm appreciative of your hard work.

    Thank you very much for taking the time to help me out

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

    Re: Maps Polygon Opacity (and Size) in WP8

    Really excellent to hear that you did it working. I did not have time for making UI's so they suck greatly there, anyway, the main point is the code, which you should help you on seeing the implementation differences with the WP7 code also available at the wiki.

Similar Threads

  1. Replies: 3
    Last Post: 2011-11-15, 13:06
  2. opacity and zindex sample code needed
    By nithyakrishnan in forum Symbian
    Replies: 1
    Last Post: 2010-06-10, 15:53
  3. OVI Maps 3 - Size of Maps-Data
    By BeSt in forum General Development Questions
    Replies: 3
    Last Post: 2010-02-06, 14:34
  4. opacity in nokias jsr 226
    By ppank in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2007-09-05, 08:08

Posting Permissions

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