This project has moved and is read-only. For the latest updates, please go here.

vmPoint screen location for clustering

Sep 29, 2015 at 10:46 AM
Edited Sep 29, 2015 at 10:48 AM
It is easy to get location of vmPoint in map space but I cannot figure out how to get screen location. I want to write clustering code to declutter the map when zoomed out. The points observable collection gets added to a map layer through binding so I can't figure out how to access it's visual tree layout information.
Sep 29, 2015 at 12:09 PM
You can always call MapBase.LocationToViewportPoint to get the viewport coordinates of a Location.
Sep 29, 2015 at 3:36 PM
Thanks Clemens.

I tried it:

var screenLocation = View.FacilityMap.LocationToViewportPoint(vmPoint.Location);

The input location was: lat 39.96959, lon -82.75106

the return value was a BIG number... X: -2442209.8153574094; Y: -213271.39551107027

No sure if i misunderstood the usage or what else might be wrong.
Sep 29, 2015 at 4:35 PM
Edited Sep 29, 2015 at 4:35 PM
Quite plausible if the map is centered at a completely different location and set to a higher zoom level.
Sep 29, 2015 at 7:38 PM
How would i get from viewport to absolute screen coordinates?
Sep 29, 2015 at 8:48 PM
Viewport coordinates are screen coordinates, relative to the upper left corner of the map control.