I'm using Silverlight plugin 5.1.3 and I'm trying to create a rectangular polygon graphic based on a mappoint. For simplicity reasons, lets assume the maps spatial reference is Web Mercator WGS84 and the rectangle is 1 Meter by 2 Meters.

How can I go about this?

| improve this question | | | | |
  • did you mean Web Mercator as the coordinate system? – DPSSpatial Aug 18 '14 at 18:39
  • Yes, sorry. Web Mercator WGS84 – DaBears Aug 18 '14 at 18:44

I needed something similar. What I did was:

  1. Created a in xaml and linked its Points value to a PointCollection variable in my model and the Visibility with another one.
  2. Then at the mouseclickevent, I get the e.GetPosition which gives you screen coordinates of you mouse.

From here, you can calculate your coners in screen coordinates, but I needed them in my coordinate system. So I did:

  1. Via mainpage.ScreenToMap(screenPoint) you can convert it to a MapPoint with a specific spatial reference system.
  2. From this point, you can calculate your corners (easier with projected reference system so you could use meters)
  3. Save you corners as screen points in the System.Windows.Media.PointCollection variable and control the visibilty of your polygon with the visibility variable.
| improve this answer | | | | |
  • Created a in xaml and linked its Points created a what? the sentence doesn't make sense – nmtoken Nov 8 '16 at 23:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.