Generating tile geometry files

Michael-James Coetzee
Satellite Intelligence
3 min readAug 29, 2019

Each image from the satellite Copernicus comes with a corresponding GEOJSON file. GEOJSON is an extension of regular json for supporting geospatial data. In this file there are a series of latitude and longitude coordinates provided which correspond to the four corners of the image.

Our tiles are cropped from the the satellite image and are 512 by 512 bits. When creating the image tiles we are dealing with a square and can just crop them by moving horizontally and vertically in 512 bit increments in a row by row fashion. These correspond to the naming scheme of the time-series tiles. For example 0-0-band-date.png is the top left-corner.

When generating the geojson files for the tile images we cannot proceed in the same way for the tile image. The image file represents a 2-d image on the earths surface and we need to account for the earths curvature.

To help with this we could make use of the library GeoPy.

Calculate the bearing between the points in our tiles as well as the distance, and with a given (lat,lon) bearing and distance we can calculate another (lat,lon) accurately and so we can accurately generate geometry files for each of our tiles.

Outline of approach:

Step 1: Get the top-left and top-right coordinates of the main area.
Step 2: Get the bearing on the line joining the coordinates.
Step 3: The angle of the line joining the top-left of the BIG images and the top left of the tile is measured.
Step 4: The angle is added to the bearing in step 2 to get the bearing of the top-left of the tile.
Step 5: The distance of the top-left of the BIG images and the top left of the tile is measured.
Step 6: The latitude and longitude of the top-left of the tile is calculated using the distance and bearings of step 4 and step 5.

The cause of the issue in the initial mask was that the geometry files did not align with image files for each tile, so pixels were associated with the coordinates that should have been associated to another pixel ( several pixels earlier) which is what caused the misalignment in the x direction.

--

--