I am searching for C# library which has code that builds spatial index in memory based on geometry bounds and enables fast searching for all geometry inside given bounds.

I prefer free library.

  • sharpmap.codeplex.com but you say where your source data is coming from MYSQL? POSTGRES, SQLSERVER, ORACLE? or file – Mapperz Dec 2 '11 at 16:20
  • I have many data sources, so I will look for most generic solution from suggestions all gave. – watbywbarif Dec 3 '11 at 17:24
  • I was looking for C# bindings for libspatialindex, but I currently don't see anything beyond Rtree for Python. – Mike T Dec 3 '11 at 23:50

There is a C#/.NET port of JTS Topology Suite: https://github.com/NetTopologySuite/NetTopologySuite

Here's the index classes: https://github.com/NetTopologySuite/NetTopologySuite/tree/develop/NetTopologySuite/Index

License Information:
NTS: https://raw.githubusercontent.com/NetTopologySuite/NetTopologySuite/develop/License.md

EDL: https://raw.githubusercontent.com/locationtech/jts/master/LICENSE_EDLv1.txt

EPL: https://raw.githubusercontent.com/locationtech/jts/master/LICENSE_EPLv1.txt

  • This looks OK, I will try to use this code and check this as answer if there is no problems. – watbywbarif Dec 3 '11 at 17:19
  • Using 1.11 version, looks OK for now. – watbywbarif Dec 14 '11 at 15:23
  • Beware. JTS is licensed under LGPL, which means you'll have to disclose the source code of your main application using it. – C. Tewalt Aug 14 '18 at 19:06
  • @matrixugly: it's dual licensed under EPL and EDL. – Jay Cummins Aug 14 '18 at 19:29
  • Ah - right. I see this from the JTS wikipedia page. "up to JTS 1.14, and the GEOS port, are published under the GNU Lesser General Public License (LGPL)." – C. Tewalt Aug 15 '18 at 16:29

Maybe try googling for specific indexing methods. For example, when I Google for C# r-tree this is the first result.

  • Of course my life would have been more simple in start if I knew that I was looking for R-Tree ;) Thx! – watbywbarif Dec 3 '11 at 17:21

Another option is to use SQLite + Spatialite in memory. Create a table with a geometry column and a spatial index and insert your geometries there. Then use SQL queries to get the matching geometries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.