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
Results 1 to 8 of 8

finding the center of a shape

This is a discussion on finding the center of a shape within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hello again- Is there an object property of a shape(polygon) that can give me a center location, so I can ...

  1. #1
    alexramo is offline Member Green Belt
    Join Date
    Sep 2008
    Posts
    63

    finding the center of a shape

    Hello again-
    Is there an object property of a shape(polygon) that can give me a center location, so I can add a textbox at that location?

    Or do I have to decipher it from a calculation?

    Or do I have to find a pushpin near the center and use that pushpin as a reference?

    If it's not possible, how about just choosing any pushpin within a selected shape and adding a textbox there?

    Any suggestions?

    THank you-
    -Alex

  2. #2
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: finding the center of a shape

    Some shapes (eg. ellipses and radius circles) have a central location property.
    I don't think this is set for freeform shapes. So you will have to calculate it, or find a pushpin in the shape. Note with the latter (which you suggest), there might not be a pushpin in the shape.


    Richard
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  3. #3
    alexramo is offline Member Green Belt
    Join Date
    Sep 2008
    Posts
    63

    Re: finding the center of a shape

    Thank you, that stinks that there is no center property for free forms

    Which choice would be easier, not neccessarily better, as I am not a programmer and I kind of just haphazardly put together snippets of code I find on the web?

    Thank you again for your help.

  4. #4
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: finding the center of a shape

    Finding a pushpin would be easier as it avoids coding up a geometry algorithm. Do a "QueryShape()" call on the dataset containing the pushpins.

    As I said before, beware! Many shapes may not have pushpins?
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

  5. #5
    alexramo is offline Member Green Belt
    Join Date
    Sep 2008
    Posts
    63

    Re: finding the center of a shape

    Once again Thank you!

    All my shapes will have pushpins, as the nature of what I am doing is drawing free forms around mapped pushpins, to cluster them together into smaller "packets" of around 100-125 pushpins each.

    So because all my shapes will have multiple pushpins, is there a way to pick the northern most pushpin, or northern most vertices, or northern most point on the polygon?(just for some kind of continuity- I have anywhere from 15-30 shapes on any one map)

    Thanks,
    -alex

  6. #6
    Paul Larson is offline Senior Member Green Belt
    Join Date
    Sep 2005
    Location
    Battle Creek, Michigan
    Posts
    136

    Re: finding the center of a shape

    In either case (pushpin or vertice) you could find the northmost or northwestmost item by iterating through the pushpin locations from QueryShape, or vertices of the shape object, and then looking for the highest latitude and longitude values.

    If you want to find the visual center of a freeform shape, as opposed to the geometric center, you could also use the iteration process to find the leftmost, rightmost, topmost and bottommost longitudes and latitudes. The visual center is half the difference of each respective value.

    HTH
    -Paul

  7. #7
    alexramo is offline Member Green Belt
    Join Date
    Sep 2008
    Posts
    63

    Re: finding the center of a shape

    Paul- thank you for helping.
    One thing I tried and it seems to work is getting the union of the vertices. I think it worked similiar if not exactly like what you were describing.

    I appreciate your time.
    -Alex

  8. #8
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: finding the center of a shape

    There's a MapInfo Pro tool that does several different kinds of centroids..

    spatialSQL for MapInfo - Advanced spatial SQL

    You can see the different types illustrated

    Geometric Centroid
    (Shifted) MBR Centroid
    Visual Centroid
    Second Visual Centroid --> 'nth VC'

    I don't know if those are generally used terms or just for this product..

    spatialSQL for MapInfo - Advanced spatial SQL - visual centroid

    For mapping I like to use the Visual Centroid.

    Unfortunately it only works with MapInfo Pro, not MapPoint.

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Query Shape- returning umber of pushpins in a shape
    By alexramo in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 01-30-2009, 10:08 AM
  2. finding center point...
    By jt_74 in forum Development
    Replies: 1
    Last Post: 12-23-2008, 07:20 PM
  3. finding if a waypoint is in an exisiting shape
    By chas in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 08-30-2006, 04:41 PM
  4. Finding Center of Data
    By kerleyp in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 08-18-2005, 04:34 PM
  5. Finding the center of a group of pushpins
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 04-07-2004, 04:51 PM

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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127