public void Setup()
 {
     polygons  = TestUtil.ReadCsvFile <HarbourPolygon, HarbourCsvClassMap>("./Resources/harbours_polygons.csv");
     index     = new GeohashSpatialIndex <int>(new DefaultGeohasher(), new DefaultTrieMap <int>(), 9);
     relations = new SpatialRelations <int>(index);
     foreach (var polygon in polygons)
     {
         index.Insert(polygon.Geom, polygon.HarbourId);
     }
 }
        public void Setup()
        {
            polygons        = TestUtil.ReadCsvFile <HarbourPolygon, HarbourCsvClassMap>("./Resources/harbours_polygons.csv");
            vesselPositions = TestUtil.ReadCsvFile <VesselPosition, VesselPositionCsvClassMap>("./Resources/vessel_points.csv")
                              .Where(position => !(position.Geom.Coordinate.Y > 90 || position.Geom.Coordinate.Y < -90 ||
                                                   position.Geom.Coordinate.X > 180 || position.Geom.Coordinate.X < -180 ||
                                                   position.Sog > 100 || position.Cog == 360)).ToList();
            polygonIndex     = new GeohashSpatialIndex <int>(new DefaultGeohasher(), new DefaultTrieMap <int>(), 9);
            pointIndex       = new GeohashSpatialIndex <int>(new DefaultGeohasher(), new DefaultTrieMap <int>(), 8);
            polygonRelations = new SpatialRelations <int>(polygonIndex);
            pointRelations   = new SpatialRelations <int>(pointIndex);
            foreach (var polygon in polygons)
            {
                polygonIndex.InsertOrUpdate(polygon.Geom, polygon.HarbourId);
            }

            foreach (var position in vesselPositions.ToList())
            {
                pointIndex.InsertOrUpdate(position.Geom, position.Mmsi);
            }
        }
 public void Setup()
 {
     emptyIndex = new GeohashSpatialIndex <int>(new DefaultGeohasher(), new DefaultTrieMap <int>(), 9);
 }
示例#4
0
 /// <summary>
 /// Returns a list of index keys and their associated bounding boxes as a geometry.
 /// This extension is useful for analyzing an index after it has been built.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="index"></param>
 /// <returns></returns>
 public static IEnumerable <(string, Polygon)> DumpIndex <T>(this GeohashSpatialIndex <T> index)
 {