Community of MapPoint and Virtual Earth Users and Developers
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. ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Pushpins from shapes 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. |
| ||||
|
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 |
| |||
|
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? |
| ||||
|
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 |
| |||
|
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." |
| ||||
|
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 |
| ||||
|
Thanks for the kind words, Take care,
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| |||
| Quote:
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.. |
| ||||
|
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 |
![]() |
| Tags |
| pushpins, shapes |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Naming Shapes | Daniel | MapPoint 2006/2009 Discussion | 2 | 08-19-2004 04:49 AM |
| Transparent shapes | Anonymous | MapPoint 2006/2009 Discussion | 2 | 06-01-2003 12:59 PM |
| ZOrder of Pushpins and Shapes | rbarthels | MapPoint 2006/2009 Discussion | 1 | 04-14-2003 01:09 AM |
| Drawing shapes on the ocx | Anonymous | MapPoint 2006/2009 Discussion | 2 | 10-01-2002 04:54 AM |
| Posting pushpins and shapes in a map | Anonymous | MapPoint 2006/2009 Discussion | 2 | 08-28-2002 10:19 AM |
Antalya Holiday
Check out the Antalya holiday options through UlookUbook and find amazing offers that suit your pocket...