View Full Version : Query by shape / polygon

01-16-2003, 05:05 AM
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


John Meyer
01-16-2003, 05:30 AM
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?

02-07-2003, 09:27 AM
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


02-07-2003, 10:19 AM
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..

For Each mpShape In mpMap.Shapes
If mpShape.Type < geoLine Then
For Each mpData In mpMap.DataSets
Set mpRec = mpData.QueryShape&#40;mpShape&#41;
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
Next mpData
End If
Next mpShape

maybe its not the pretiest code.. but it does the job well for me so far

02-10-2003, 02:05 AM
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!


02-10-2003, 09:30 AM
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?



02-12-2003, 03:23 AM
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.


02-12-2003, 03:35 AM
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!