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

Query by shape / polygon

This is a discussion on Query by shape / polygon within the MapPoint Desktop Discussion forums, part of the Map Forums category; Is it possible with mappoint drawing a polygon and then search for all user-defined pusphins lying within that polygon? I ...

  1. #1
    blackmap is offline Member Yellow Belt
    Join Date
    Dec 2002
    Posts
    39

    Query by shape / polygon

    Is it possible with mappoint drawing a polygon and then search for all user-defined pusphins lying within that polygon?
    I want to do this via VB Code. Any ideas?

    Thanks a lot



    Peter

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    In the help file there is a method "QueryPolygon method" that has an example. I'm not sure if you have seen that and are looking for something else or what?

  3. #3
    blackmap is offline Member Yellow Belt
    Join Date
    Dec 2002
    Posts
    39
    Yep, it works.

    Problem is: Every shape is drawn by a square. I want the user to draw the shap onto the map.
    Some codesnipplets / ideas out there?

    Thanks a lot

    Peter

  4. #4
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    i did the same thing a couple of weeks ago.. you can use all the tools offered by mappoint as long as you use "Close Curve" to create a valid polygone..

    only thing you cant use is Highlight ..


    i tested with the following . freeform, rectangle, scribble and line.

    if you want code i can retreive some..

    Code:
          For Each mpShape In mpMap.Shapes
            If mpShape.Type < geoLine Then
              For Each mpData In mpMap.DataSets
                Set mpRec = mpData.QueryShape&#40;mpShape&#41;
                mpRec.MoveFirst
                Do While mpRec.EOF = False
                  'Found .?
                  If mpRec.Pushpin.Name = "Pin #" & i Then
                    frm_main.txt_event = "Found" & i & vbCrLf & frm_main.txt_event
                    found = True
                    GoTo FOUND_IT 'save some time
                  End If
                  mpRec.MoveNext
                Loop
              Next mpData
            End If
          Next mpShape
    FOUND_IT&#58;
    maybe its not the pretiest code.. but it does the job well for me so far

  5. #5
    blackmap is offline Member Yellow Belt
    Join Date
    Dec 2002
    Posts
    39
    This is what I already have, I need the part of the code for getting the user-defined points for the freeform...
    Maybe you have some code-snipplets for that?

    Thanks anyway!

    Peter

  6. #6
    blackmap is offline Member Yellow Belt
    Join Date
    Dec 2002
    Posts
    39
    What I did now is: I show the user the drawing toolbar so that the user can drw a polygon. But how do I get the polygon programmaticaly so I can execute the queryPolygon method?

    Besides: I wanted the user to draw the polygon without the draw-toolbar. Any ideas?

    Thanks

    Peter

  7. #7
    AndyYule is offline Junior Member White Belt
    Join Date
    Jan 2003
    Posts
    8

    Areas within a user defined polygon

    Haven't tried it yet but I need to do something similar - what I've thought is to use the MouseDown to log all the points as the user clicks on the map - translate the screen positions to real coordinates using XYToLocation - this provides your location object that can then be added to your own array. Then use the array of location in the AddPolyLine method... well it seems like a good idea :) If I get it working I'll post something.

    Andy

  8. #8
    blackmap is offline Member Yellow Belt
    Join Date
    Dec 2002
    Posts
    39
    This is exactly what I need. I do not work on it right now. If you got it first, it would be very nice if you send the code!

    Greetings from Berlin / Germany!

    :-)

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, 09:51 PM
  2. Locate nearest polygon shape
    By Dazzer in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-12-2004, 09:19 AM
  3. Information within polygon
    By Dazzer in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-28-2004, 08:50 AM
  4. Distance from Polygon
    By random0000 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-14-2003, 09:18 PM
  5. query shape produces wrong results
    By David Kachuck in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-24-2002, 09:52 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