ThinkGeo.com    |     Documentation    |     Premium Support

ThinkGeo.Core Image generation using NAIP

We want to integrate NAIP Imagery in our system.
for this we need to create map server Tile using RectangleShape or latitude and longitude details.
how to generate map server tile’s X,Y and Z values?

Thanks,
The web api product support this. Here is the samples. https://samples.thinkgeo.com/webapi/#Openlayers-Layers You can download the sample here
https://gitlab.com/thinkgeo/public/thinkgeo-web-maps/-/tree/master/samples/web-api/LayersSample

You will find we have the method to get the tile by x,y,z

    // Draw the map and return the image back to client in an IActionResult.
    private IActionResult DrawTileImage(LayerOverlay layerOverlay, int z, int x, int y)
    {
        using (GeoImage image = new GeoImage(256, 256))
        {
            GeoCanvas geoCanvas = GeoCanvas.CreateDefaultGeoCanvas();
            RectangleShape boundingBox = WebApiExtentHelper.GetBoundingBoxForXyz(x, y, z, GeographyUnit.Meter);
            geoCanvas.BeginDrawing(image, boundingBox, GeographyUnit.Meter);
            layerOverlay.Draw(geoCanvas);
            geoCanvas.EndDrawing();

            byte[] imageBytes = image.GetImageBytes(GeoImageFormat.Png);

            return File(imageBytes, "image/png");
        }
    }

Thanks

Frank

Thanks Frank for quick reply.
We do not have x,y and z value to create tile. We only have Rectangle shape data and Latitude Longitude details.
We want to know how we can use these details to calculate x,y and z value.

Thanks,
Basically you don’t need know the XYZ value. The client application will tell you XYZ it needed.
Here is more information about the XYZ tile system.

https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames

So the client application will ask give me the X,Y, Z tile. The server side just generate the tile base on the X,Y,Z value. This is how most application works.

If you real want to use rectangle shape data and Latitude Longitude to calculate the X,Y,Z. The input information is not enough. You need at least specify the z value.That mean you need specify rectangle shape(extent) and the zoom level(Z) to get all tiles in current extent and zoom level.

TileMatrix tileMatrix = new TileMatrix(mapView1.ZoomLevelSet.ZoomLevel07.Scale, 256, 256, MaxExtents.OsmMaps, GeographyUnit.Meter); // This one spcify the zoom level
var tiles = tileMatrix.GetIntersectingCells(mapView1.CurrentExtent); // This one specify the extent.

It return multiple tiles with X,Y value.

Thanks

Frank