MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




QueryPolygon Results Question

This is a discussion on QueryPolygon Results Question within the Development forums, part of the MapPoint 2006/2009 Discussion category; I am relatively new to MapPoint. I am coding a Windows Forms app (VB.NET 2005) using the OCX that ships ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  4 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 01-10-2008
Junior Member
White Belt
 
Join Date: Dec 2007
Posts: 3
Question QueryPolygon Results Question

I am relatively new to MapPoint. I am coding a Windows Forms app (VB.NET 2005) using the OCX that ships with MapPoint 2006. In this app, I am using the QueryPolygon method to select all the pushpins that are in the currently visible area of the map control. The code:

locations(0) = objMap.XYToLocation(0, 0)
locations(1) = objMap.XYToLocation(objMap.Width, 0)
locations(2) = objMap.XYToLocation(objMap.Width, objMap.Height)
locations(3) = objMap.XYToLocation(0, objMap.Height)
locations(4) = objMap.XYToLocation(0, 0)
Dim objDataSet As MapPoint.DataSet = objMap.DataSets(1)
objSelectedPushpins = objDataSet.QueryPolygon(locations)

I'm finding that when I have pushpins near the edges of the map, some of the pushpins at the top of the map are not always being selected while some pushpins just below the visible portion of the map are being selected. This seems to most prevalent when I'm zoomed out.

My theory is that while I'm feeding the QueryPolygon method coordinates of a perfect rectangle, that rectangle needs to be applied to a spherical object in the background (i.e. the Earth) before the data can be queried. The rectangle is distorted by the curvature of the Earth. This causes a visual discrepancy between what you think should be selected and what actually gets selected.

Am I making any sense at all? If so, does anyone know if my theory is correct? Does QueryPolygon take the curvature of the Earth into consideration and might that account for what I'm seeing? Or do I just have a bug?

Thanks.
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 01-10-2008
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,322
Blog Entries: 1
Re: QueryPolygon Results Question

I'm sure your theory is correct, but I don't have any recommendation. You must be looking at pretty large areas?

Can you give an example of the exact coordinates?

Have you drawn the polygon on the map to see what it looks like?

Eric
__________________
~ 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 01-15-2008
Senior Member
Green Belt
 
Join Date: Sep 2005
Location: Marshall, Michigan
Posts: 122
Red face Re: QueryPolygon Results Question

I've come across this issue as well. Your theory is correct.
The rectangle is computed and rendered in flat-space, when it should be rendered as a trapezoid with curved east-west sides.

The only solution I came up with at the time was to expand the rectangle into a hexagon with the east-west points expanded outward according to the current zoom level. I wound up breaking/expanding the east-west points at one-third north of the lesser absolute latitude. (south of the equator, you'd use one-third south)

This does still incorporate some error, particularly at the east-west points, but it is far less than the flat-space rectangle.

HTH
-Paul
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


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/querypolygon-results-question-6993.html

Posted By For Type Date
MapPoint Download - MP2K Magazine This thread Refback 01-13-2008 07:41 AM
Automating MapPoint with Perl - MapPoint Articles - MP2K Magazine This thread Refback 01-13-2008 12:22 AM
Spambayes Install For Outlook Express - MapPoint Articles - MP2K Magazine This thread Refback 01-12-2008 08:32 PM
The Magazine for MapPoint - MP2K Magazine This thread Refback 01-10-2008 01:00 PM

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
QueryPolygon Error dfriebus Development 2 12-31-2007 07:51 AM
Two results for one address :-( alex_kuechler MapPoint 2006/2009 Discussion 8 03-08-2007 04:24 AM
GPS Coordinates Results tommyf MapPoint 2006/2009 Discussion 10 02-14-2007 03:02 AM
FindAddress Results in c# starbuck MapPoint 2006/2009 Discussion 1 09-21-2004 05:00 PM
help - new user, no results Anonymous Products: Pushpin Tool, Single State Mapper 1 07-29-2003 10:56 PM


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

Cheap flights to Madrid
Visit Madrid with bullfighting and the "Golden Triangle of Art" ready for you to view. For cheap flights to Madrid book here.

Greece Holidays
Find great Greece Holidays with Travel Counsellors. A personal Travel Counsellor can help you plan the perfect holiday to Greece.

Cheap Flights to Cape Town
Here at dealchecker.co.uk we’ll shop around for cheap flights to Cape Town so you don’t have to. Find and Compare prices from over twenty UK travel agents with just one search.

Holidays to Barbados
Holidays to Barbados have so much to offer. Enjoy the beauty of this Caribbean island for less by booking your holiday through us.

Canaries
Find out all about the Canaries when you check out the ulookubook.com travel guides. Not only can you get a great holiday deal but you can find out useful information about potential holiday destinations.

Cheap Travel
For cheap travel options, visit Travel.co.uk and explore the benefits of our comparison site.

Cheap Holidays in Gran Canaria
Would you like to visit the Canary Islands, but you're on a budget? Get information on cheap holidays in Gran Canaria 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