public SourceDto Invoke() { if (!_mapData.HasLayer(WorkspaceId, LayerId)) { throw new EntityNotFoundException(); } var src = _mapData.GetLayer(WorkspaceId, LayerId).Source; src.Tiles = new[] { $"{_urlGenerator.BuildUrl(RouteNames.GetLayer, new {WorkspaceId, LayerId})}/tile" + "/{x}/{y}/{z}" }; return(src); }
public ActionResult Invoke() { var styles = _mapData.HasLayer(WorkspaceId, LayerId) ? _mapData.GetLayer(WorkspaceId, LayerId).Styles : throw new EntityNotFoundException(); return(new JsonResult(styles, new JsonSerializerSettings() { Formatting = Formatting.Indented, ContractResolver = new CamelCasePropertyNamesContractResolver() })); }
public ActionResult Invoke(int x, int y, int z) { y = (1 << z) - y - 1; // convert xyz to tms return(_mapData.HasLayer(WorkspaceId, LayerId) ? new ContentResult { StatusCode = (int)HttpStatusCode.OK, Content = _mapData.GetLayer(WorkspaceId, LayerId).Grid(x, y, z), ContentType = "application/json" } : throw new EntityNotFoundException()); }
public async Task <ActionResult> Invoke() { var layer = _mapData.HasLayer(WorkspaceId, LayerId) ? _mapData.GetLayer(WorkspaceId, LayerId) : throw new EntityNotFoundException(); return(new JsonResult(new LayerDto { Id = layer.Id, Name = layer.Name, Description = layer.Source.Description, MbTileMd5 = await _tileStorage.GetMd5($"{WorkspaceId}/{LayerId}.mbtiles"), CustomStyleMd5 = await _styleStorage.GetMd5($"{WorkspaceId}/{LayerId}.json"), Links = _resourceLinksGenerator.GenerateResourceLinks(WorkspaceId, LayerId) }, new JsonSerializerSettings { Formatting = Formatting.Indented, ContractResolver = new CamelCasePropertyNamesContractResolver() })); }
public ActionResult Invoke(int x, int y, int z) { var layer = _mapData.HasLayer(WorkspaceId, LayerId) ? _mapData.GetLayer(WorkspaceId, LayerId) : throw new EntityNotFoundException(); y = (1 << z) - y - 1; // convert xyz to tms var bytes = layer.Tile(x, y, z); switch (layer.Source.Format) { case "png": return(File(bytes, "image/png")); case "jpg": return(File(bytes, "image/jpg")); case "pbf": return(File(Decompressor.Decompress(bytes), "application/vnd.mapbox-vector-tile")); default: throw new Exception("unsupported layer source format"); } }
public ActionResult Invoke() { return(_mapData.HasLayer(WorkspaceId, LayerId) ? Content(JsonUtils.JsonPrettify(_mapData.GetLayer(WorkspaceId, LayerId).DataJson.ToString()), "application/json") : throw new EntityNotFoundException()); }