MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Selected Area

This is a discussion on Selected Area within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Lets say i have selected an area and in the area that i selected there are pushpins. Is there anyway ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-21-2002
Junior Member
White Belt
 
Join Date: Aug 2002
Posts: 11
Selected Area

Lets say i have selected an area and in the area that i selected there are pushpins. Is there anyway of finding out the pushpins that reside in that area through code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 08-21-2002
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,380
Blog Entries: 1
No.. as you're probably aware, working interactively you can do it with right-click / Export to Excel.. MapPoint does not offer this programmatically. If you're ambitious, you could export the polygon and points ( http://www.mp2kmag.com/importersub01.asp ) for processing in a GIS or your own alghorithm ( search for the for "point-in-polygon alghorithm ).
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 08-21-2002
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Give this a try, I think it will do what your asking. I'm just counting the number of pushpins in the selected area (the rectangle made when holding the left mouse button and dragging) but you could get there name/location or whatever you need.. BTW, If you did not select an area it will just exit sub.

Private Sub Command1_Click()
On Error GoTo error:
Dim objmap As MapPointctl.Map
Set objmap = MappointControl1.ActiveMap

Dim sa As MapPointctl.SelectedArea
Set sa = objmap.SelectedArea

Dim objDataSet As MapPointctl.DataSet
Dim objRecords As MapPointctl.Recordset


Dim objLocs(1 To 5) As MapPoint.Location
Set objLocs(1) = objmap.XYToLocation(sa.Left, sa.Top)
Set objLocs(2) = objmap.XYToLocation(sa.Left + sa.Width, sa.Top)
Set objLocs(3) = objmap.XYToLocation(sa.Left + sa.Width, sa.Top + sa.Height)
Set objLocs(4) = objmap.XYToLocation(sa.Left, sa.Top + sa.Height)
Set objLocs(5) = objmap.XYToLocation(sa.Left, sa.Top)

'Remove the comment from the next line to see the polygon being queried
'objmap.Shapes.AddPolyline objLocs

lngCount = 0

For Each objDataSet In objmap.DataSets
Set objRecords = objDataSet.QueryPolygon(objLocs)
objRecords.MoveFirst
Do While Not objRecords.EOF
lngCount = lngCount + 1
objRecords.MoveNext
Loop
Next
MsgBox "Number of records in polygon: " & lngCount

Exit Sub
error:
MsgBox Err.Description
End Sub
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 08-22-2002
Junior Member
White Belt
 
Join Date: Aug 2002
Posts: 11
John,
I was playing with something like the code below and sometimes all the records fall in and sometimes i lose one or two points but your solution seems to work better so thank you.
P.S.
i wouldn't mind if you tell me why my code lost those points.
Dim objshape As MapPoint.Shape

Set objshape = objMap.Shapes.AddShape(geoShapeRectangle, objMap.SelectedArea.Location, objMap.SelectedArea.Width / 100, objMap.SelectedArea.Height / 100)
objshape.Select
For Each objDataSet In objMap.DataSets
If InStr(objDataSet.Name, "My Pushpins") Then
Set objRecordset = objDataSet.QueryShape(objshape)
Do Until objRecordset.EOF
objRecordset.Pushpin.Highlight = True
objRecordset.MoveNext
Loop
End If
Next
objshape.Delete
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 08-22-2002
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Amanuel,

Your welcome. One thing my code does it check every dataset. Your code has the if statment so only looks at the "My Pushpins" dataset. If you have more than one dataset, that could explain it.

Another thing you could try is run both peices of code but don't delete the shapes, see if they are covering different locations?
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
area, selected


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
CopyMap AND Keep Selected Area Anonymous MapPoint 2006/2009 Discussion 1 04-15-2005 02:58 PM
find streets in a selected area Anonymous MapPoint 2006/2009 Discussion 0 10-20-2004 10:36 AM
How to get selected vertex in a polyline Anonymous MapPoint 2006/2009 Discussion 2 07-11-2004 10:10 AM
reading each pinpoint with a selected area of the map Anonymous MapPoint 2006/2009 Discussion 1 10-18-2003 05:28 PM
Determining what has been selected? Anonymous MapPoint 2006/2009 Discussion 1 04-06-2003 08:34 PM


All times are GMT -5. The time now is 08:21 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Ski Chalets
Don't miss out on the delights of ski chalets. Book accommodation to suit your ski holiday requirement online at Holiday Hypermarket.

Flights to Portugal
Find and book flights to Portugal. Travel Counsellors can help with travel to Portugal including flights and accommodation.

Portugal Holiday
For such a small country, you have many options from which to choose. A Portugal Holiday can include fantastic beaches and stunning scenery. Check out our great deals.

Holidays to Sri Lanka
Holidays to Sri Lanka are enriched by the glittering tapestry of culture and breath taking mountain views. Book a holiday there today!

Morocco
Gain insight on your holiday destination with the ULookUBook travel guides. Find out about Morocco and its customs online. Make an informed decision when you make a booking.

Family activity holidays
Family holidays can be full of fun activity. Check out your options at Travel.co.uk

Cheap Cyprus Holidays
Rejuvenate mind and body! Visit the Mediterranean! Cheap Cyprus holidays can be viewed at On The Beach!


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