Community of VE/MapPoint Users and Developers
This is a discussion on QueryShape recordset returning empty within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello folks I am using MP 2k4 with VB6. I set objApp.visible = true to see what's going on. I ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| QueryShape recordset returning empty I am using MP 2k4 with VB6. I set objApp.visible = true to see what's going on. I create my dataset from SQL Server I then create my autoshape I see both in the MapPoint instanced window, all my pushpins AND my circle BUT when I go to populate my recordset via set oMRS = oDS.QueryShape(oCurrentShape) the recordset is empty. I DO fire off a oCurrentShape.Select before hand. I'm puzzled, I see the shape, I see the points, but the recordset is empty. Any thoughts anyone ? I am certainly creating my dataset first, THEN the shape, which should be right. Tim Miltz p.s. I also set altitude to shape radius + 1 |
| |||
| Re: QueryShape recordset returning empty
Update: I notice if I go over to the instanced MapPoint application, and change the radius of my circle shape, even 1/10th of a mile, one pixel - go back to my app debug mode, set objrecords = oDS.QueryShape(objCurrentShape) indeed it returns with the pushpins inside the shape. So, somehow it's not setting up the shape for query - I DO call a oCurrentShape.Select before querying though. Anyone know what has to be done to a shape object, other than bringing focus to it ? to qualify it for QueryShape method to function ? thanks in advance Tim Miltz |
| ||||
| Re: QueryShape recordset returning empty
Sounds strange. I don't think you even have to "Select" the shape. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
| Re: QueryShape recordset returning empty
I know, it is strange. Odd, in debug mode, if I call .QueryShape on my shape object (circle here, and I do know I can do circle and rectangle by other means (trig/mathematics etc), but I will also Oval and of course use of .QueryPolygon for other shape types) and check recordset ? it's emtpy BUT If I hop over to the instanced MapPoint, select my circle shape that I see created with my pushpins brought in via a UDL / SQL Server table dataset import, return, retry .QueryShape, STILL empty, BUT, if I MOVE that circle in MapPoint Instance - even one tiny bit, THEN go back and fire .QueryShape - indeed there is my collection of points in a populated recordset. So somehow there is a disconnect. I have also tried referring to my shape as the 1 based array element of the shapes collection 'item(1)' and still doesn't affect anything. I did read your post WinWaed on making sure to plot points FIRST, then draw the shape. So, that's all good my side. In that it does return the proper results IF I move the shape in MapPoint itself sounds to me like somehow it's being registered as a shape on the active map, where before it's not being seen via object model, yet ? It's all created on a New map from the start. I mention that it does return the recordset not empty IF I move the shape in MP instance manually because it seems to be a hint somehow that MP see's the shape OM wise, with the points, but for some reason it doesn't 'register' it or 'see' the shape until that manual operation. I was not expecting this, that's for sure. heh Tim Miltz |
| |||
| Re: QueryShape recordset returning empty
Just noticed. If I go over to MapPoint Instance... Until I actually 'move' the circle shape - and try Export to Excel manually, 'No data found' but once I move it, or nudge it, it exports the pushpins underlying. This is reminding me of ESRI Map Objects with 'Layers' in that it seems it's not treating the pushpins and shape on the same map, but MP doesn't have layers. Tim Miltz |
| |||
| Re: QueryShape recordset returning empty
Well, I'm no Euclid. But I DID observe I specified GeoAutoShapeType.geoShapeRadius heh in going to attempt a queryShape on an Oval I allow to be loaded, I observed, hey, my oval is a perfect circle ! What ? Then it occurred to me GeoAutoShapeType.geoShapeOval applied for my circle shape indeed gives me my populated recordset. I'll check benchmark for performance to see if use of geoShapeRadius will indeed be any faster if not, I'm going to live in a world where a circle is an infinite sided polygon and an oval is merely an infinite sided polygon with sides of varying length ! I think this problem was due to wrong shape type all along. Tim Miltz |
| ||||
| Re: QueryShape recordset returning empty
The last time I did a lot of query shape stuff was with FoxPro and MP2004. I've just gone back to my code, and found I had two experiments. One manually searched the pins. It used a "QueryCircle" call to cull the pushpins to a manageable level, and then iterated over them checking where they were. I had to work with screen coordinates, so this had the advantage that the final location comparison could be accurately performed using screen coordinates. The second approach used a shape (created to be an approximation of a rectangle that is defined in screen coordinates). Here's the 'guts' of the code: Code: && Perform the actual query oRecordList = oDataSet.QueryPolygon( @myLocs ) && Process the query result - if you want a complete recordset && then use it here, instead, loop through doing something with each pin if (oRecordList.MatchingMethod != geoByTerritory) oRecordList.MoveFirst && Loop over all of the pushpins in the record list do while not oRecordList.EOF thisPin = oRecordList.Pushpin &&& thisPin is a pushpin within the selected area!!! &&& Do something interesting with it thisPin.Symbol = thisPin.Symbol + 1 && Move to the next pushpin oRecordList.MoveNext enddo endif Not sure if this helps, but might give you a way forward. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
| Re: QueryShape recordset returning empty
Thankyou very much for your time you took with your insights WinWaed. For one, we'll be picking up your import tool - I'm glad someone took the time to MASTER that task - I found the process buggy - even altering the Add In code and you too probably, but I'm sure you've refined it a bit that was off subject and maybe too commercial, but you deserve it ! but as to my dilemma I found the problem, QueryCircle exists for a reason, I didn't know. I did read your prior posts on doing such calculations using basic Trig etc. programming 29 years, maybe a few years out for a Dead tour here or there, but still - I'm drawn too towards the pure mathematical resolvancy through simple code if possible - such as the Distance via Lat Lon in regards to offset of the oblateness of the planet code I see here so often ( though, it's not exact YET ).... but - QueryCircle was the solution for that shape. QueryPolygon is working fine, QueryShape is working fine and now the circle objects are working fine with QueryCircle. Not on the MP Team (boy they have bad marketing and lack of direction for the FULL potential to WHAM ESRI and MapInfo, even Manifold) well I don't see under the hood what shortcuts they took for QueryCircle - but I can see why the exposed an exception for that - heh - thanks again, and Eric, thanks also for sharing your Point in Poly work - that's no fun stuff there - making it all work - I'm sure MS MP team also had FUN with Querypolygon - there are paradoxes that are outstanding I think with it. Let's all be glad MP doesn't go 3-d yet ! heh Wish all the best (new tag line for me as of this moment) Tim Miltz (HEY, my parents never asked me what I wanted for a name !) Etaion Software (to date, we've only produced buggy code ! but we aspire to do better) |
![]() |
| Tags |
| empty, queryshape, recordset, returning |
| ||||
| Posted By | For | Type | Date | |
| The Magazine for MapPoint - MP2K Magazine | This thread | Refback | 01-28-2008 12:47 PM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Why is PushPin.Note empty? | myaso | MapPoint 2006/2009 Discussion | 0 | 10-25-2006 08:26 AM |
| problems with queryshape | chas | MapPoint 2006/2009 Discussion | 1 | 09-08-2006 02:52 PM |
| the map is empty after Show/Hide form with MapPoint control | Anonymous | MapPoint 2006/2009 Discussion | 1 | 03-25-2004 04:24 PM |
| QueryShape problem Please help | Anonymous | MapPoint 2006/2009 Discussion | 2 | 03-13-2003 09:57 AM |
| Deriving a recordset from a mappoint recordset | RichardHayes | MapPoint 2006/2009 Discussion | 0 | 09-06-2002 03:44 AM |