user7241370
user7241370

Reputation:

How to use R-Tree of NetTopologySuite in GMap.NET to display abundant marker WPF

I am using GMap.NET to display a lot of Marker (about more than 10.000 markers). R-Tree is a solution to optimize render markers at area which window is showing.

STRtree in NetTopologySuite is a library to support R-tree. But I'm not sure it suitable for this problem.

My question is how to use R-Tree in NetTopologySuite to show markers. I don't know how to use library. (I'm new in WPF). How to catch event when GMap render marker to get marker from R-Tree and remove previous marker at same time?

Please give me some example about R-tree in NetTopologySuite.

Upvotes: 0

Views: 793

Answers (1)

user7241370
user7241370

Reputation:

I did it by my way. This is the way STRtree is decleared: STRtree<Coordinate> gpsSTRtree = new STRtree<Coordinate>(); You can change Coordinate data type by any other data type but STRtree need to Envelope to insert to tree.

For example: insert to STRtree: Coordinate gps = new Coordinate(9.74233, 106.0213); Envelope item = new Envelope(gps); gpsSTRtree.Insert(item, gps);

Envelope is a node in STRtree to store the boundary of item.

STRtree query from two points. point1 and point2 are Coordinate Envelope gpsQuery = new Envelope(p1, p2); Coordinate gpsItems = gpsSTRtree.Query(gpsQuery);

Then you have a list of Coordinate

Good luck

Upvotes: 1

Related Questions