get drew rectangle location and boundry features

Jan 25, 2010 at 2:47 PM

Hi Radioman,

it is me again, with my rectangle :) . In my project, i tried to get drew rectangle boundry features at runtime like Lat, Lon, HeightLat, WidthLng...etc.  to save to a database, and i want to use that features to draw that rectangle on to the map with a button event, later.

I use this code,

RectLatLng rectangle = MainMap.SelectedArea;

but i think this code is not suitable with my purpose, and it is draw rectangle at wrong location. Is there any other code to get drew rectangle features? 

Jan 25, 2010 at 4:03 PM
Edited Jan 25, 2010 at 4:04 PM

there is red rectangle marker in demo


Jan 26, 2010 at 7:22 AM

But I  want to draw a rectangle with alt keyboard button + mouse, and i want to save that rectangle to the database, with its size and location.

Jan 26, 2010 at 7:53 AM

ahh, well then just save it, and use 4 columns in your table

RectLatLng(double lat, double lng, double widthLng, double heightLat);

Jan 26, 2010 at 8:55 AM

I wrote to a database, and i draw a rectangle according to that data(Lat, Lng, widthLng, heightLat) on to the map  with reading my database, but it accepts the starting point of the rectangle as its center, however the data belongs to the rectangle's starting point, not center.

Jan 26, 2010 at 11:39 AM

so whats the problem?

Jan 26, 2010 at 12:19 PM

The problem is that, it is drawn at wrong location. The Lat-Long which is my Top-Left Corner point of the rectangle, is based as center of the rectangle. The Lat-Long is my top-left point, not center. 

Jan 26, 2010 at 12:45 PM

so why can't you add Offset(-width/2, -height/2) ?

Jan 26, 2010 at 1:59 PM

I can get  HeightLat and WidthLng, but I think it is not equal to rectangle width and height. How can I get width and height of rectangle?

<font face="Consolas" size="3"><font face="Consolas" size="3">


</font></font><font face="Consolas" size="3">




PointLatLng pLL = Rectangle.Size.ToPointLatLng();


Jan 28, 2010 at 12:16 PM

Hi Radioman,

I solved that rectangle issue.

1- ) Decleration of generic list,

List<RectLatLng> rect = new List<RectLatLng>();

2- ) Get selected area of rectangle,

RectLatLng selectedArea = MainMap.SelectedArea;

3 -)Save the rectangle area into the generic list,


4-)And get the saved rectangle area

MainMap.SelectedArea = rect[0];

Thank you for your help...



Jan 28, 2010 at 1:23 PM

..can you explain more about what are you coding?

Jan 28, 2010 at 3:50 PM

The aim is Vehicle Tracing Project. I must trace vehicle whether it is inside of a rectangle or outside of a rectangle. For testing, i create rectangle which is pinned on to the map(above codes are doing this pin job). When user clicks inside of drawn rectangle it return true, otherwise false.  Because of that, at runtime, the rectangle have to be visible.