PDA

View Full Version : How do I find customers inside a rectangle?



dwsanborn
05-01-2009, 04:45 PM
I am writing some routing software in c#. The user wants to be able to draw a rectangle and I should exclude all stops within the rectangle. I am trying to do it with "Avoid Area". (I am using MapPoint 2006 right now)

I can get the MapPoint.Shape from the area and I can get Latitude and Longitude from the Shape. Do the latitude and longitude correspond to the top left corner? Is it possible to get the latitude and longitude for the bottom right corner?

Is there a better way to do this?

Thanks all!

Winwaed
05-01-2009, 06:15 PM
It is the centre of the rectangle.

You then have to use the rectangle size to try to calculate the corners.

Note that the rectangle is drawn as a rectangle parallel to the screen coordinate system - the exact mapping of the corners depends on the orientation/etc of the map. This is only really visible to the human eye when looking at larger shapes - it probably isn't visible at the city level. You just have to come up with a calculation that is "good enough" for your needs, and realise that the corners can 'drift' a bit if the user moves the map zoom/pan.

Richard