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
Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

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. #11
    Wilfried is offline 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. #12
    Rushmore is offline 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 05:14 PM. Reason: Correction

  3. #13
    jlewis is offline 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...
    John Lewis

  4. #14
    Wilfried is offline 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 FirstFirst 12

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Does an object reside in my Shape or Shape boundaries?
    By hotrdd in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-04-2005, 10:51 PM
  2. Getting the coordinates from a freeform shape
    By pst in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 07-14-2005, 08:19 AM
  3. Coordinates of regular shape
    By Dazzer in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-08-2005, 09:15 AM
  4. I need some coordinates
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 03-25-2004, 11:56 AM
  5. Get coordinates in C#
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 10-31-2003, 08:11 AM

Tags for this Thread

Posting Permissions

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


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96