Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

 Subscribe to receive our newsletter. Subscribe Unsubscribe

## Shape coordinates

This is a discussion on Shape coordinates within the MapPoint Desktop Discussion forums, part of the Map Forums category; I need to retreive the latitude and longitude coordinates of the corners of a shape (rectangle). The way that Ive ...

1. Junior Member White Belt
Join Date
Sep 2005
Posts
6

## Shape coordinates

I need to retreive the latitude and longitude coordinates of the corners of a shape (rectangle). The way that Ive tried it is to take the centre location. Convert it into XY values, then take the width and height of the shape and then minus half the width and height from the centre XY values to retreive the upper left corner coordinates and then add them to get the lower right coordinates. Then using these I can calculate their locations. However when I do this the push pins that should appear on the corner of the shape, appear somewhere within the shape. Any ideas?

Im sure someone has already done this. Please help.

2. Junior Member White Belt
Join Date
Sep 2005
Posts
6
Ive been messing around and Ive found my problem. The centre point of the shape is given as a location that when converted into XY coordinates gives the pixel position. The width and height of the shape are masured in GeoUnits (km/miles). So how do I find a location that is exactly x miles east and y miles north of another location.

3. Junior Member White Belt
Join Date
Sep 2005
Posts
6
Ah ha, I use the PixelSize method. Please dont reply Ive done it now. Cheers anyway

4. Senior Member Black Belt
Join Date
Nov 2004
Location
Belgium
Posts
2,433
Hi,

Thanks for feedback. It can benefit others too

5. Junior Member White Belt
Join Date
Jan 2007
Posts
5

## Re: Shape coordinates

Please can you post a little example. I am playing around but can not get it work. Regardless if I am using the PixelSize or not.

Thank you.

6. Member Green Belt
Join Date
Nov 2006
Posts
93

## Re: Shape coordinates

Rushmore,

What can't you get it work? Be more specific please.

Maybe this is your solution:
* Create a rectangular shape
* Select it
* Call the selected area (which is the selected rectangular)
* Get its top/left area (which is in pixels)
* Get its width/height (which is also in pixels)
* Calculate its angle positions of the rectangle (which is also the selected area) and ofcourse these are all in pixels
* Than convert them to Lon/Lat, there is a function for it.
* Voila, you're done!

I hope that's your solution and I also hope next time you wil help me too

7. Junior Member White Belt
Join Date
Jan 2007
Posts
5

## Re: Shape coordinates

Originally Posted by VC_Man

* Create a rectangular shape
* Select it
* Call the selected area (which is the selected rectangular)
* Get its top/left area (which is in pixels)
* Get its width/height (which is also in pixels)
* Calculate its angle positions of the rectangle (which is also the selected area) and ofcourse these are all in pixels
* Than convert them to Lon/Lat, there is a function for it.
* Voila, you're done!
Ok, I have created the rectangular shape. Then I have called the Select()-Method from the shape. The shape is selected now! But If I look at the SelectedArea properties, the height, top, width and left properties are zero. What I am doing wrong?

I am using C# VS 2005 and Mappoint 2006.

8. Member Green Belt
Join Date
Nov 2006
Posts
93

## Re: Shape coordinates

Rushmore,

If you created a SelectedArea object, doesn't mean you have all the content in it. It is just an object you created, with nothin assigned to it, thus all the propperty's are ofcourse zero or empty. What you have to do is something like this in C#:
Code:
```SelectedArea oSel;
oSel = Mappoint.SelectedArea;

/* Than do the things you want */

long /*double*/ width = oSel.width;
//etc......```
I hope this will help, if not maybe Wilfried can help you, he's a C# programmer also.

9. Senior Member Black Belt
Join Date
Nov 2004
Location
Belgium
Posts
2,433

## Re: Shape coordinates

Hi,

Originally Posted by Rushmore
Ok, I have created the rectangular shape. Then I have called the Select()-Method from the shape. The shape is selected now! But If I look at the SelectedArea properties, the height, top, width and left properties are zero.
I'm not sure if I understeand it right. A selected shape is not a selected area. A selected area is when you draw an area on the map using the mouse, like when you have to zoom in to an area. From this area you can create the shape. Is that what you want ?

10. Junior Member White Belt
Join Date
Jan 2007
Posts
5

## Re: Shape coordinates

Originally Posted by Wilfried
Hi,

I'm not sure if I understeand it right. A selected shape is not a selected area. A selected area is when you draw an area on the map using the mouse, like when you have to zoom in to an area. From this area you can create the shape. Is that what you want ?
The main problem is, that I have a lot of pushpins (hydrants). If I display all hydrants as pushpins on the map, it is very slow (and not necessary too). So I have created a circle with a radius of 300m. But that is really difficult to handle. I have to select all hydrants from the database between the drawn circle. So I think it is easier to use the rectangular shape, I have only 4 coords to determine. But now I canīt figure out how to determine the left upper corner, right upper corner etc.

I need only the four locations (of the shape) to select the hydrants from the database.
But how?

Thank you.

Page 1 of 2 12 Last

#### Thread Information

##### Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

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