Welcome to MapForums!

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

## Shape coordinates

This is a discussion on Shape coordinates within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, Not tested but: width and height are the width and height of the shape. They are in this example ...

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

## Re: Shape coordinates

Hi,

Not tested but: width and height are the width and height of the shape. They are in this example in km. centerLat and centerLon are the lat and long of the shape (you have it in the Location property).

First convert the units (km) to nautical miles. Then as this example show it is easy to calculate the left top coordinates of the shape. The 3 other you can find yourself I gues. If you need help just ask If your units are in miles then 1 mile == 1.6093 km.

The reason for the nautical miles is because 1 nautical mile is exact 1 minute of the earth circle. So easy to use in the calculations.

the Cosinus is neede to correct the longitude because lat==long only on equater.

Code:
double nauticalMilesHeight = height / 1.852;    // heigth and width are in km
double nauticalMilesWidth = width / 1.852;      // so we convert to nautical miles
double leftTopLat = centerLat + nauticalMilesHeight / 2 / 60;
double leftTopLon = centerLon - nauticalMilesWidth / 2 / 60 / Math.Cos(centerLat);

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

## Re: Shape coordinates

Code:
double nauticalMilesHeight = height / 1.852;    // heigth and width are in km
double nauticalMilesWidth = width / 1.852;      // so we convert to nautical miles
double leftTopLat = centerLat + nauticalMilesHeight / 2 / 60;
double leftTopLon = centerLon - nauticalMilesWidth / 2 / 60 / Math.Cos(centerLat);
That is a great approach. But if I want the left top corner exactly, I have to decrease by 0.00099 instead of using the cosinus. Why? Please help me to understand what I am doing BTW, If I use the Math.Cos, the location is placed on the right side.

Code:
double leftTopLat = centerLat + ((nauticalMilesHeight / 2) / 60);
double leftTopLon = (centerLon - nauticalMilesWidth / 2 / 60) - 0.00099 ;
Thank you for the hint, I am working on it.

The 0.00099 is only, If the width/height is 0.300!
Last edited by Rushmore; 03-01-2007 at 04:14 PM. Reason: Correction

3. Member Yellow Belt
Join Date
Apr 2006
Posts
33

## Re: Shape coordinates

I haven't checked this - but - if you have a shape object, you could use the Shape.Vertices array (an array of Locations that make up the shape) to find out the coordinates of the corners.

Also, using the ImportData method to bring in your pushpins (from a csv) is really quick - I found that creating 3000 pushpins individually took about 3 or 4 minutes on my machine - using ImportData it took about 2 seconds!

Hope this helps...

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

## Re: Shape coordinates

Hi,

You right my calcuation is not complete right because it takes the cosine of centerLat. And you should take the cosine of the top latitude. Same for bottom there you chould take the cosine from the bottom latitude.

The larger your shape is the more this becomes importand.

Page 2 of 2 First 12