Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 8 of 8

QueryShape recordset returning empty

This is a discussion on QueryShape recordset returning empty within the MapPoint Desktop 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 ...

  1. #1
    tfmiltz is offline Member Green Belt
    Join Date
    Feb 2005
    Posts
    52

    QueryShape recordset returning empty

    Hello folks

    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

  2. #2
    tfmiltz is offline Member Green Belt
    Join Date
    Feb 2005
    Posts
    52

    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

  3. #3
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    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

  4. #4
    tfmiltz is offline Member Green Belt
    Join Date
    Feb 2005
    Posts
    52

    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

  5. #5
    tfmiltz is offline Member Green Belt
    Join Date
    Feb 2005
    Posts
    52

    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

  6. #6
    tfmiltz is offline Member Green Belt
    Join Date
    Feb 2005
    Posts
    52

    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

  7. #7
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    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

  8. #8
    tfmiltz is offline Member Green Belt
    Join Date
    Feb 2005
    Posts
    52

    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)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Why is PushPin.Note empty?
    By myaso in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-25-2006, 08:26 AM
  2. problems with queryshape
    By chas in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-08-2006, 02:52 PM
  3. the map is empty after Show/Hide form with MapPoint control
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-25-2004, 04:24 PM
  4. QueryShape problem Please help
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 03-13-2003, 09:57 AM
  5. Deriving a recordset from a mappoint recordset
    By RichardHayes in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 09-06-2002, 03:44 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85