Пример #1
0
        private static void TileNorway()
        {
            var layer = new TiledVectorLayer("test2", WebMercator.BoundingBox1, 39135.75848201024 * 4);
            var store = new DiskTileStore(layer);

            store.Wipe();
            var tiler    = new VectorTiler(store, layer);
            var filename = FileLocator.FindFileInTree(@"data\norway.geojson");
            FeatureCollection        norway       = JsonConvert.DeserializeObject <FeatureCollection>(File.ReadAllText(filename));
            List <OmrådeMedGeometry> partOfNorway = new List <OmrådeMedGeometry>();

            foreach (var feature in norway.Features)
            {
                partOfNorway.Add(new OmrådeMedGeometry(new Område(3581, AreaType.Land), DotSpatialGeometry.From(feature)));
            }
            foreach (var omg in partOfNorway)
            {
                omg.Område.Number = -5;
            }
            for (int zoom = 0; zoom < 6; zoom++)
            {
                foreach (OmrådeMedGeometry polygon in partOfNorway)
                {
                    tiler.Update(polygon.Område, polygon.Geometry, zoom);
                }
            }
        }
Пример #2
0
        public static TileCoordinates GetTileCoordinates(TiledVectorLayer layer, double x, double y, double resolution,
                                                         bool reverseIntersectionPolicy, int z)
        {
            var scale  = resolution / layer.GetResolution(z);
            var origin = layer.GetOrigin(z);

            return(GetTileCoordForXyAndResolution(x, y, resolution, reverseIntersectionPolicy, origin, scale, z));
        }
Пример #3
0
        public TileToDisk()
        {
            var layer = new TiledVectorLayer("test2", WebMercator.BoundingBox1, 39135.75848201024 * 4);
            var store = new DiskTileStore(layer);

            store.Wipe();
            tiler = new VectorTiler(store, layer);
        }
Пример #4
0
        public DiskTileStore(TiledVectorLayer layer)
        {
            this.layer = layer;

            var mapsPath = Config.Settings.Map.MapLayersPath;

            storagePath = Path.Combine(mapsPath, layer.Name);
            CreateDirectory(storagePath);
        }
Пример #5
0
        public TilePolygonTest()
        {
            var layer = new TiledVectorLayer("", bbox, 39135.75848201024 * 4)
            {
                TileOverlapRatio = 0
            };

            store = new TestTileStore(layer);
            tiler = new VectorTiler(store, layer);
        }
Пример #6
0
        public BoundingBox GetExtent(TiledVectorLayer layer)
        {
            var    origin     = layer.GetOrigin(ZoomLevel);
            double resolution = layer.GetResolution(ZoomLevel);
            double minX       = origin.X + X * TiledVectorLayer.TileSize * resolution;
            double minY       = origin.Y + Y * TiledVectorLayer.TileSize * resolution;
            double maxX       = minX + TiledVectorLayer.TileSize * resolution;
            double maxY       = minY + TiledVectorLayer.TileSize * resolution;

            return(new BoundingBox(minX, maxY, maxX, minY));
        }
Пример #7
0
        public BoundingBox GetExtent(TiledVectorLayer layer)
        {
            Point  origin     = layer.GetOrigin(ZoomLevel);
            double resolution = layer.GetResolution(ZoomLevel);
            double rminX      = origin.X + minX * TiledVectorLayer.TileSize * resolution;
            double rmaxX      = origin.X + (maxX + 1) * TiledVectorLayer.TileSize * resolution;
            double rminY      = origin.Y + minY * TiledVectorLayer.TileSize * resolution;
            double rmaxY      = origin.Y + (maxY + 1) * TiledVectorLayer.TileSize * resolution;

            return(new BoundingBox(rminX, rmaxY, rmaxX, rminY));
        }
Пример #8
0
        public TileRangeTest()
        {
            TiledVectorLayer layer = new TiledVectorLayer("", bbox, 39135.75848201024 * 4);

            tiler = new VectorTiler(new TestTileStore(layer), layer);
        }
Пример #9
0
 public TestTileStore(TiledVectorLayer layer)
 {
     this.layer = layer;
 }
Пример #10
0
        public static TileCoordinates GetTileCoordinates(double x, double y, double resolution, bool reverseIntersectionPolicy, TiledVectorLayer layer)
        {
            var z = layer.GetZForResolution(resolution);

            return(GetTileCoordinates(layer, x, y, resolution, reverseIntersectionPolicy, z));
        }
Пример #11
0
        public static TileRange GetTileRangeForExtentAndZ(IEnvelope extent, int z, TiledVectorLayer layer)
        {
            var resolution = layer.GetResolution(z);

            return(GetTileRangeForExtentAndResolution(extent, resolution, layer));
        }
Пример #12
0
        public static TileRange GetTileRangeForExtentAndResolution(IEnvelope extent, double resolution, TiledVectorLayer layer)
        {
            var z  = layer.GetZForResolution(resolution);
            var ll = TileCoordinates.GetTileCoordinates(layer, extent.Minimum.X, extent.Minimum.Y, resolution, false, z);
            var ur = TileCoordinates.GetTileCoordinates(layer, extent.Maximum.X, extent.Maximum.Y, resolution, true, z);

            return(new TileRange(z, ll.X, ur.X, ll.Y, ur.Y));
        }
Пример #13
0
 public VectorQuadTile(TileCoordinates tile, TiledVectorLayer layer) : base(tile.GetExtent(layer), tile.ZoomLevel, tile.X, tile.Y)
 {
 }
Пример #14
0
 public VectorTiler(IPersistStuff <VectorQuadTile> testTileStore, TiledVectorLayer layer)
 {
     this.layer = layer;
     tileStore  = testTileStore;
 }