MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Pushpins from shapes

This is a discussion on Pushpins from shapes within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I have seen posts discussing how to find pushpins in shapes. The solution suggested was to use the 'Dataset.QueryShape' method. ...


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 03-18-2004
Junior Member
White Belt
 
Join Date: Mar 2004
Posts: 4
Pushpins from shapes

I have seen posts discussing how to find pushpins in shapes. The solution suggested was to use the 'Dataset.QueryShape' method.

As a new MapPoint user, I can't figure out *how* to set things up (in code) in order to use this method.

Assuming I have a map with shapes, and each shape has a pushpin in (on?) it, what steps, in code, would I need to go through? I would like to generate a collection (dataset? resultset?) that holds all pushpins found in each shape. (My sense is that we're talking on the order of 10 lines of code.)

Thanks very much.
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 03-18-2004
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Have you taken a look in mappoint.chm ? It should be loacated in your mappoint directory. (compiled help file)

Open it
click programming information (Last item in list)
click Microsoft MapPoint Visual Basic Reference
click Methods
click QueryShape method
__________________
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
  #3 (permalink)  
Old 03-18-2004
Junior Member
White Belt
 
Join Date: Mar 2004
Posts: 4
Yes, I was there.

But this code segment (which is from that example):

'Let user create a data map
Set objDataSet = _
objApp.ActiveMap.DataSets.ShowImportWizard


opens up a dialog box, and prompts me to import a data file that I don't have.

Why must I import a data file in order to retrieve a Recordset of pushpins and shapes?
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 03-18-2004
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Just comment that out and run it again. Thats there for example in case you do not have and data on the map (pushpins)
__________________
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
  #5 (permalink)  
Old 03-18-2004
Junior Member
White Belt
 
Join Date: Mar 2004
Posts: 4
But doesn't that still leave me without a valid objDataSet?

This line will fail:
Set objRecords = objDataSet.QueryShape(objShape)

As you suggest, there should be a dataset available from my pushpins.

I found this in the help file:
" ... or when you create a Pushpin with the Create Pushpin drawing tool. The default name of this data set is My Pushpins. "

So, I tried this:
Set objDataSet = objmap.DataSets("My Pushpins")

But I get the following error:
"The requested member of the collection does not exist. Use a valid name or index number."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 03-18-2004
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Ok, Here is an example that will create a drivetimezone (a shape) and report how many pushpins are in it. (Put a pushpin in Tampa, FL) You should be able to adapt this to work with other shapes as needed.... My MapPoint Control is named MapPointCtl so you may need to edit the code or change the name of your control.... Let me know if you have success with this sample.

Code:
Dim objmap As MapPointCtl.Map
Dim objDataSet As MapPointCtl.DataSet
Dim objRecords As MapPointCtl.Recordset
Dim objshape As MapPointCtl.Shape
Dim lngCount As Long
Dim objloc1 As MapPointCtl.Location
Dim aDriveTimeZone As MapPointCtl.Shape

Set objmap = MappointControl1.ActiveMap
Set objloc1 = objmap.FindResults("Tampa, FL").Item(1)
Set objshape = objmap.Shapes.AddDrivetimeZone(objloc1, 20 * geoOneMinute)
objshape.Select

For Each objDataSet In objmap.DataSets
 Set objRecords = objDataSet.QueryShape(objshape)
 objRecords.MoveFirst
  Do While Not objRecords.EOF
   lngCount = lngCount + 1
    objRecords.MoveNext
  Loop
Next
MsgBox "Number of records in shape: " & lngCount
__________________
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
  #7 (permalink)  
Old 03-18-2004
Junior Member
White Belt
 
Join Date: Mar 2004
Posts: 4
Fantastic.

Thanks very much for your continued assistance.

I think I'm on my way -- thanks to you.

Best wishes,

-- Glenn
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 03-18-2004
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Thanks for the kind words,

Take care,
__________________
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
  #9 (permalink)  
Old 03-28-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Quote:
Originally Posted by John Meyer
Ok, Here is an example that will create a drivetimezone (a shape) and report how many pushpins are in it. (Put a pushpin in Tampa, FL) You should be able to adapt this to work with other shapes as needed.... My MapPoint Control is named MapPointCtl so you may need to edit the code or change the name of your control.... Let me know if you have success with this sample.

Code:
Dim objmap As MapPointCtl.Map
Dim objDataSet As MapPointCtl.DataSet
Dim objRecords As MapPointCtl.Recordset
Dim objshape As MapPointCtl.Shape
Dim lngCount As Long
Dim objloc1 As MapPointCtl.Location
Dim aDriveTimeZone As MapPointCtl.Shape

Set objmap = MappointControl1.ActiveMap
Set objloc1 = objmap.FindResults("Tampa, FL").Item(1)
Set objshape = objmap.Shapes.AddDrivetimeZone(objloc1, 20 * geoOneMinute)
objshape.Select

For Each objDataSet In objmap.DataSets
 Set objRecords = objDataSet.QueryShape(objshape)
 objRecords.MoveFirst
  Do While Not objRecords.EOF
   lngCount = lngCount + 1
    objRecords.MoveNext
  Loop
Next
MsgBox "Number of records in shape: " & lngCount
hi,

i tried the exact thing above and it doesnt return any records. i've been trying this for quite a while now, but numerous attempts have only led to frustration. it doesnt give an errormessage or something, but the above example doesnt create any datasets.
is a dataset supposed to be created automatically when a queryshape is executed? is there some setting for this?

would be thankfull for any replies..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 03-28-2004
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Did you add some pushpins to the tampa area?
__________________
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
pushpins, shapes


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
Naming Shapes Daniel MapPoint 2006/2009 Discussion 2 08-19-2004 05:49 AM
Transparent shapes Anonymous MapPoint 2006/2009 Discussion 2 06-01-2003 01:59 PM
ZOrder of Pushpins and Shapes rbarthels MapPoint 2006/2009 Discussion 1 04-14-2003 02:09 AM
Drawing shapes on the ocx Anonymous MapPoint 2006/2009 Discussion 2 10-01-2002 05:54 AM
Posting pushpins and shapes in a map Anonymous MapPoint 2006/2009 Discussion 2 08-28-2002 11:19 AM


All times are GMT -5. The time now is 10:29 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


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