This project has moved. For the latest updates, please go here.

Polylines drawn appear at different locations than specified

Mar 1, 2013 at 5:48 AM
Hi,
I'm developing a WinRT app and have modified my map parts to use XAML Map Control instead of Bing Maps. Most functionality works as expected but when I draw polylines, they appear at completly different Locations than they did in Bing Maps.

My approach is to draw several polylines at coordinates close to each other. Some of These polylines are closed, some have a fill color, some have a line stroke instead.
All polylines are seperated across different MapItemsControl objects. On the map, the polylines appear vertically below each other instead of being at the same location. (Panning down on the map reveals the polyline expected at the original Position). I don't know why it happens. Is there any possibility to chat about it?

Thanks in advance.

Andreas
Coordinator
Mar 1, 2013 at 7:49 AM
It's hard tell what's going wrong without seeing you code. Please provide a minimal example that shows the wrong behaviour.

I have to admit that I haven't thoroughly tested the MapControl on WinRT, but at least the MapPolylines in the example application do work as expected.
Mar 1, 2013 at 8:49 PM
Hello Clemens,
thanks for the answer. Yes it is possible to show you the code and application, e.g. in Skype. My nick is andreas-balzer.
I have uploaded sample screenshots.
Here you can see the expected result from our Bing Maps implementation: http://imageshack.us/photo/my-images/829/bingzn.png/
This is what we get with the same objects rendered by XAML Map Control: http://imageshack.us/photo/my-images/189/actualc.png/
This is the XAML Map control at a specific zoom: http://imageshack.us/photo/my-images/577/actualzoom1.png/
This is the same at another zoom: http://imageshack.us/photo/my-images/571/actualzoom2.png/
Notice how the objects come closer to each other.

The Locations of the objects are at the same positions and fixed. Due to the BingMaps architecture we currently render each object with a fill twice (once for the stroke and once for the fill). Here is a shortend list of mappolylines we draw: shape: ;48,2623695,11,6678977;48,2620062,11,6677449;48,2620367,11,6675821;48,2624012,11,6677328;48,2624488,11,6674762;48,262085,11,6673247;48,2621149,11,6671624;48,2625405,11,6673387;48,2625809,11,6671263;48,2623341,11,6670592;48,2623933,11,6665527;48,2626813,11,6666295;48,2626451,11,6669339;48,2627084,11,6669511;48,2627507,11,666595;48,2628469,11,6666209;48,2632856,11,6667396;48,2632658,11,6669058;48,262826,11,6667857;48,2627923,11,6670841;48,2632305,11,6672018;48,2632102,11,6673691;48,2627682,11,667248;48,2627342,11,6675429;48,263175,11,6676646;48,263155,11,6678324;48,2627174,11,6677138;48,2626815,11,6680082;48,2631187,11,6681278;48,2630994,11,6682957;48,2626594,11,6681777;48,2626237,11,6684731;48,2630639,11,6685911;48,2630439,11,668758;48,26254,11,6686226;48,262491,11,6690258;48,2622734,11,6689666;48,2622309,11,6691993;48,2617712,11,669006;48,261802,11,6688414;48,2621677,11,6689912;48,2622132,11,6687371;48,2618501,11,6685858;48,2618614,11,6685249;48,2618804,11,6684217;48,2622447,11,6685732;48,2622915,11,668318;48,2619279,11,6681659;48,2619591,11,6680021;48,2623235,11,6681515;48,2623695,11,6678977
shape: ;48,2623695,11,6678977;48,2620062,11,6677449;48,2620367,11,6675821;48,2624012,11,6677328;48,2624488,11,6674762;48,262085,11,6673247;48,2621149,11,6671624;48,2625405,11,6673387;48,2625809,11,6671263;48,2623341,11,6670592;48,2623933,11,6665527;48,2626813,11,6666295;48,2626451,11,6669339;48,2627084,11,6669511;48,2627507,11,666595;48,2628469,11,6666209;48,2632856,11,6667396;48,2632658,11,6669058;48,262826,11,6667857;48,2627923,11,6670841;48,2632305,11,6672018;48,2632102,11,6673691;48,2627682,11,667248;48,2627342,11,6675429;48,263175,11,6676646;48,263155,11,6678324;48,2627174,11,6677138;48,2626815,11,6680082;48,2631187,11,6681278;48,2630994,11,6682957;48,2626594,11,6681777;48,2626237,11,6684731;48,2630639,11,6685911;48,2630439,11,668758;48,26254,11,6686226;48,262491,11,6690258;48,2622734,11,6689666;48,2622309,11,6691993;48,2617712,11,669006;48,261802,11,6688414;48,2621677,11,6689912;48,2622132,11,6687371;48,2618501,11,6685858;48,2618614,11,6685249;48,2618804,11,6684217;48,2622447,11,6685732;48,2622915,11,668318;48,2619279,11,6681659;48,2619591,11,6680021;48,2623235,11,6681515;48,2623695,11,6678977
shape: ;48,2623579,11,6683662;48,2623673,11,66837
shape: ;48,2622378,11,668192;48,2622356,11,668205;48,2622335,11,668218
shape: ;48,2621266,11,6681739;48,2621294,11,6681611
shape: ;48,2622902,11,6682135;48,2622874,11,6682264
shape: ;48,2624346,11,667946;48,2624453,11,6679505
shape: ;48,2626298,11,6677306;48,2626179,11,6677282
shape: ;48,2621069,11,6681374;48,2621047,11,668151;48,2621026,11,6681638
shape: ;48,262326,11,6685291;48,2623374,11,668534
shape: ;48,2624044,11,6681097;48,2624149,11,6681136
shape: ;48,262762,11,6666207;48,2626298,11,6677306;48,2625643,11,6682797;48,2625261,11,6686006
shape: ;48,2620535,11,6681427;48,2620555,11,6681307;48,2620577,11,6681175
shape: ;48,2622913,11,6686552;48,2623132,11,6686639
shape: ;48,2621883,11,6681718;48,2621861,11,6681845;48,2621839,11,6681971
shape: ;48,2625643,11,6682797;48,2625518,11,6682769
shape: ;48,2623418,11,6682489;48,2623393,11,6682629;48,2623374,11,6682742
shape: ;48,2622657,11,6682314;48,2622683,11,6682185;48,2622708,11,6682055
shape: ;48,2623927,11,6682345;48,2624055,11,6682376
shape: ;48,2620413,11,6681109;48,2620389,11,6681238;48,2620365,11,6681357
shape: ;48,2619896,11,6681035;48,2620389,11,6681238;48,2620555,11,6681307;48,2621047,11,668151;48,2621294,11,6681611;48,2621699,11,6681779;48,2621861,11,6681845;48,2622356,11,668205;48,2622519,11,6682118;48,2622683,11,6682185;48,2622874,11,6682264;48,2623418,11,6682489;48,2623575,11,6682553;48,2623863,11,6682671
shape: ;48,262355,11,6682691;48,2623575,11,6682553
shape: ;48,2621726,11,6681655;48,2621699,11,6681779;48,2621676,11,6681904
shape: ;48,2623489,11,6684163;48,2623584,11,6684202
shape: ;48,2625518,11,6682769;48,2625249,11,6682695;48,2624055,11,6682376
shape: ;48,2623462,11,6682381;48,2623418,11,6682489
shape: ;48,2622163,11,6691818;48,2623132,11,6686639;48,2623374,11,668534;48,2623495,11,6684687;48,2623584,11,6684202;48,2623673,11,66837;48,2623747,11,6683308;48,2623863,11,6682671;48,2623915,11,6682408;48,2623927,11,6682345;48,2624149,11,6681136;48,2624273,11,6680472;48,2624361,11,6680001;48,2624453,11,6679505;48,2624965,11,6676768;48,262558,11,6673467
shape: ;48,2626179,11,6677282;48,2625266,11,6676893;48,2625088,11,6676818
shape: ;48,2625221,11,6682901;48,2625249,11,6682695
shape: ;48,262369,11,6682324;48,2623915,11,6682408
shape: ;48,2623153,11,6684563;48,2623495,11,6684687
shape: ;48,2624258,11,6679959;48,2624361,11,6680001
shape: ;48,2623649,11,6683273;48,2623747,11,6683308
shape: ;48,2619917,11,6680908;48,2619896,11,6681035;48,2619877,11,6681154
shape: ;48,2625297,11,667672;48,2625266,11,6676893
shape: ;48,2623922,11,6680345;48,2624273,11,6680472
shape: ;48,2622544,11,6681992;48,2622519,11,6682118;48,2622497,11,6682248
shape: ;48,2624965,11,6676768;48,2625088,11,6676818
shape: ;48,2623084,11,6682741;48,2623108,11,6682625;48,2623374,11,6682742
shape: ;48,2622903,11,6681426;48,2623074,11,6681496;48,2622954,11,6682156;48,2622902,11,6682135;48,2622783,11,6682086;48,2622903,11,6681426
shape: ;48,2622903,11,6681426;48,2623074,11,6681496;48,2622954,11,6682156;48,2622902,11,6682135;48,2622783,11,6682086;48,2622903,11,6681426
shape: ;48,2623622,11,6683423;48,2623579,11,6683662;48,2623503,11,6684081;48,2622825,11,6683805;48,2622944,11,6683147;48,2623338,11,668331;48,2623338,11,668331;48,2623622,11,6683423
shape: ;48,2623622,11,6683423;48,2623579,11,6683662;48,2623503,11,6684081;48,2622825,11,6683805;48,2622944,11,6683147;48,2623338,11,668331;48,2623338,11,668331;48,2623622,11,6683423
shape: ;48,2623678,11,6683108;48,2623649,11,6683273;48,2623622,11,6683423;48,2623338,11,668331;48,2623338,11,668331;48,2623394,11,6682995;48,2623678,11,6683108
shape: ;48,2623678,11,6683108;48,2623649,11,6683273;48,2623622,11,6683423;48,2623338,11,668331;48,2623338,11,668331;48,2623394,11,6682995;48,2623678,11,6683108
shape: ;48,2622615,11,6683009;48,2622686,11,6682632;48,2622848,11,6682695;48,2622827,11,6682814;48,2622783,11,6683074;48,2622615,11,6683009
shape: ;48,2622615,11,6683009;48,2622686,11,6682632;48,2622848,11,6682695;48,2622827,11,6682814;48,2622783,11,6683074;48,2622615,11,6683009
shape: ;48,2623168,11,6684481;48,2623153,11,6684563;48,2623079,11,668497;48,2622647,11,6684793;48,2622735,11,6684304;48,2623168,11,6684481
shape: ;48,2623168,11,6684481;48,2623153,11,6684563;48,2623079,11,668497;48,2622647,11,6684793;48,2622735,11,6684304;48,2623168,11,6684481
shape: ;48,2619488,11,6680735;48,2619607,11,6680072;48,2620109,11,6680273;48,261999,11,6680936;48,2619917,11,6680908;48,2619488,11,6680735
shape: ;48,2619488,11,6680735;48,2619607,11,6680072;48,2620109,11,6680273;48,261999,11,6680936;48,2619917,11,6680908;48,2619488,11,6680735
shape: ;48,2622462,11,6681955;48,2622378,11,668192;48,2622124,11,6681817;48,2622243,11,6681156;48,2622575,11,6681292;48,2622462,11,6681955
shape: ;48,2622462,11,6681955;48,2622378,11,668192;48,2622124,11,6681817;48,2622243,11,6681156;48,2622575,11,6681292;48,2622462,11,6681955
shape: ;48,2622647,11,6684793;48,2622464,11,6685796;48,2623116,11,6686057;48,262326,11,6685291;48,2623305,11,668505;48,2623079,11,668497;48,2622647,11,6684793
shape: ;48,2622647,11,6684793;48,2622464,11,6685796;48,2623116,11,6686057;48,262326,11,6685291;48,2623305,11,668505;48,2623079,11,668497;48,2622647,11,6684793
shape: ;48,2623741,11,6682766;48,2623678,11,6683108;48,2623394,11,6682995;48,2623455,11,6682654;48,262355,11,6682691;48,2623741,11,6682766
shape: ;48,2623741,11,6682766;48,2623678,11,6683108;48,2623394,11,6682995;48,2623455,11,6682654;48,262355,11,6682691;48,2623741,11,6682766
shape: ;48,2620119,11,6681256;48,2620365,11,6681357;48,2620535,11,6681427;48,2620611,11,6681458;48,262049,11,6682107;48,2619997,11,668191;48,2620119,11,6681256
shape: ;48,2620119,11,6681256;48,2620365,11,6681357;48,2620535,11,6681427;48,2620611,11,6681458;48,262049,11,6682107;48,2619997,11,668191;48,2620119,11,6681256
shape: ;48,2620981,11,668232;48,2621103,11,668167;48,2621266,11,6681739;48,2621431,11,6681808;48,2621309,11,6682458;48,2620981,11,668232
shape: ;48,2620981,11,668232;48,2621103,11,668167;48,2621266,11,6681739;48,2621431,11,6681808;48,2621309,11,6682458;48,2620981,11,668232
shape: ;48,2622752,11,6681364;48,2622636,11,6682026;48,2622544,11,6681992;48,2622462,11,6681955;48,2622575,11,6681292;48,2622752,11,6681364
shape: ;48,2622752,11,6681364;48,2622636,11,6682026;48,2622544,11,6681992;48,2622462,11,6681955;48,2622575,11,6681292;48,2622752,11,6681364
shape: ;48,2624389,11,6679218;48,2624346,11,667946;48,2624273,11,6679874;48,2623599,11,6679604;48,2623715,11,6678948;48,2624389,11,6679218
shape: ;48,2624389,11,6679218;48,2624346,11,667946;48,2624273,11,6679874;48,2623599,11,6679604;48,2623715,11,6678948;48,2624389,11,6679218
shape: ;48,2624085,11,6680878;48,2624044,11,6681097;48,2623902,11,6681866;48,2623532,11,6681709;48,2623243,11,6681591;48,2623418,11,6680591;48,2623849,11,6680777;48,2624085,11,6680878
Coordinator
Mar 1, 2013 at 9:55 PM
It's pointless to post all the polyline data here. Just show the relevant XAML or code parts.
Mar 2, 2013 at 12:16 AM
Hi,
yes I figured out that the problem is more complex than just drawing lines.

Actually I've been trying to create a second project to reproduce the issue. Unfortunately so far I have not succeeded and yet don't know why it happens in the project I am working on. Is there any reason/method known to you that leads to objects being drawn closer together when the user zooms in and drawn farther away when the user zooms out? Usually it should be the other way around.

The only hint I figured out so far is that these MapPolylines seem to behave more like a pushpin that hasn't been set with a MapPanel.SetLocation.

I'm still working on reproducing the issue in a Project with less than 20,000 lines of code..

Andreas
Mar 2, 2013 at 1:08 AM
How can I send you the code privately?
Coordinator
Mar 2, 2013 at 9:45 AM
Edited Mar 2, 2013 at 9:45 AM
I guess the problem is that the MapPolyline is the child of a container control that has the MapPanel.Location property set, and hence "behaves like a pushpin". As MapPolylines get their Geometry transformed by a Map's ViewportTransform, it is necessary that their parent container fills the entire map area.

In the example application MapPolylines are contained in a MapItemsControl which uses a MapPanel as ItemsPanel. Each MapItem container in this MapItemsControl has Stretch as default value for the HorizontalAlignment and VerticalAlignment properties and hence fills the entire parent area.
Apr 5, 2013 at 8:42 AM
Edited Apr 5, 2013 at 8:44 AM
I think I might have the same issue or at least something similar to it. I am processing gps data and as I zoom out the polyline gets jittered and just looks strange.
I uploaded 2 screenshots: Screenshots

As I zoom in the line looks as it should but while zooming out small parts of it grow. Since there are over 6000 points its hard to find out which of them are causing the issue.

This is wpf.