Register  |  Login
ThinkGeo - GPS Tracking and Mapping Solutions  |  Visit the Wiki  |  Find us on: Twitter Facebook Google+ LinkedIn

Discussion Forums

The online community for users of Map Suite GIS components

Poor performance with SpatialQuery and polygon shape
Last Post 01-12-2012 08:35 AM by Val. 5 Replies.
Printer Friendly
Sort:
NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
SindreUser is Offline
Level 2
Level 2
Posts:41
Avatar

--
01-06-2012 07:10 AM

Hello,

I am developing an application which draws travel routes (for ships) on a map and the route has a "buffered" area, allowing a threshold for the route (see attached image).

Further, I am using a spatial query to calculate which objects this route is intersecting.

_layer.SpatialQuery(routeArea, SpatialQueryContainment.Containing);

The problem is that when the route follows a great circle, the routeArea becomes a complex polygon and thus the above query becomes very slow compared to a straight line in which case the area is simply a rectangle.

Is there any way to improve the performance of the above query? Last option is to remove the buffered area and just use a line shape, but that would also mean removing an important feature so I really do not want that.

Please let me know if the question is unclear.

Example:

(running query on the curved shape is extremely slow)

ValUser is Offline
MVP
MVP
Posts:1634
Avatar

--
01-06-2012 02:05 PM

Sindre,

  I would use DistanceQuery instead of SpatialQuery and do the distance query based on the distance that you used to create the buffer on your Great Circle. This is going to be more efficient than doing a spatial query on a polygon (the buffer) that contains a large number of vertices. You are still using Map Suite 2.x? This version is obsolete by almost five years now.

SindreUser is Offline
Level 2
Level 2
Posts:41
Avatar

--
01-11-2012 05:49 AM

Val,

Thank you for your reply. Unfortunately, the method DistanceQuery does not seem to exist. I noticed there is a method QueryByDistance on Layer, but I am using DynamicLayer in order to create the map shapes on the fly. They are not contained in a shape file.

Any idea?

PS: I know that v2.x is quite old, but many of our users are still on .NET Framework 2 so it is not really an option for us to upgrade.

ValUser is Offline
MVP
MVP
Posts:1634
Avatar

--
01-11-2012 10:17 AM

Sindre,

  My memory failed. I meant QueryByDistance, not DistanceQuery which is the function name in the current API. If you are using DynamicLayer, you can get the shape and each shape has a function called GetDistanceTo where you pass the other shape, the distance unit and the unit the map is in. And that way you can check the distance. I hope this helps.

SindreUser is Offline
Level 2
Level 2
Posts:41
Avatar

--
01-12-2012 07:54 AM
Val,

Thank you. I tried using the get_DistanceTo method, but unfortunately the performance is even worse with this approach. I guess I just have to remove this feature for now.
ValUser is Offline
MVP
MVP
Posts:1634
Avatar

--
01-12-2012 08:35 AM

Sindre,

 I am sorry we could not help you more concretely on this. We stopped doing active support on Map Suite 2.x and earlier.

You are not authorized to post a reply.

Active Forums 4.2