1

I would like to run a deep learning model over an AOI that is about 300,000 square kilometers. I used the dl.scenes.DLTile.from_shape function to automatically divide the region into tiles.

Is there an easy way to visualize the grid of tiles that was generated?

Just the polygons themselves, not having to pull any imagery.

1

You can use the Descartes Labs Workflows API to display the dltile outlines on an interactive map. The following code extracts feature information from the dltiles, then puts them into an ipyleaflet.GeoJSON layer that is then displayed.

import descarteslabs as dl
import descarteslabs.workflows as wf

import ipyleaflet
import geojson


# Define an aoi
gj = {
    "type":"Feature","geometry":{
        "type":"Polygon",
        "coordinates":[
            [
                [-106.88330923670608,34.20485282310794],
                [-105.57800417298154,34.20485282310794],
                [-105.57800417298154,34.938762734834086],
                [-106.88330923670608,34.938762734834086],
                [-106.88330923670608,34.20485282310794]
            ]
        ]
    }
}
    
# Get dltiles from within the aoi
tiles = dl.scenes.DLTile.from_shape(
    gj,
    resolution=30,
    tilesize=512,
    pad=10
)

# Convert dltiles to geojsons
tile_gjs = [tile.__geo_interface__ for tile in tiles]

# Create a FeatureCollection and put it into a GeoJSON layer
gjs = ipyleaflet.GeoJSON(
    data=geojson.FeatureCollection(tile_gjs),
    style={
        'fillOpacity':0,
        'color':'red'
    }
)

# Create map
m = wf.map
m.center = (34.5799, -106.1182)
m.zoom = 9

# Add geojsons to the map
m.add_layer(gjs)

# Display map
m
1
  • Thanks! Exactly what I needed.
    – lilswang
    Feb 3 '21 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.