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 1 of 2 12 LastLast
Results 1 to 10 of 14

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. #1
    MarkStanley is offline 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. #2
    MarkStanley is offline 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. #3
    MarkStanley is offline 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. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

  5. #5
    Rushmore is offline 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. #6
    VC_Man is offline 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. #7
    Rushmore is offline Junior Member White Belt
    Join Date
    Jan 2007
    Posts
    5

    Re: Shape coordinates

    Quote Originally Posted by VC_Man View Post

    * 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. #8
    VC_Man is offline 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. #9
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Shape coordinates

    Hi,

    Quote Originally Posted by Rushmore View Post
    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. #10
    Rushmore is offline Junior Member White Belt
    Join Date
    Jan 2007
    Posts
    5

    Re: Shape coordinates

    Quote Originally Posted by Wilfried View Post
    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 LastLast

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