Clipping tile service to polygon on google map

Hi --

I'm using both the API Tile Service and Basemap Tile Service on top of a google map as shown in the code below. Works great.

I'm trying to clip the tile to a polygon. I think I used to do a clip-and-ship on asset downloads, but I haven't been able to clip the tile layer to my Area of Interest. It might be possible to create a new google layer type, but I'm looking for something more straightforward.

Many thanks!

Dan

      let planetId=planet[i];
      let thisLayer='https://tiles.planet.com/data/v1/' + scene_type + '/' +
      planetId + '/{z}/{x}/{y}.png?api_key=' + PL_API_KEY;
      let planetTile=newgoogle.maps.ImageMapType({
        getTileUrl:function (coord, zoom) {
          // "Wrap" x (logitude) at 180th meridian properly
          // NB: Don't touch coord.x because coord param is by reference, and changing its x property breaks something in Google's lib
          var tilesPerGlobe = 1 << zoom;
          var x = coord.x % tilesPerGlobe;
          if (x < 0) {
            x = tilesPerGlobe + x;
          }
          // Wrap y (latitude) in a like manner if you want to enable vertical infinite scroll
          return 'https://tiles.planet.com/data/v1/' + scene_type + '/' +
            planetId + '/' + zoom + '/' + x + '/' + coord.y + '.png?api_key=' + PL_API_KEY;
        },
        tileSize:newgoogle.maps.Size(256, 256),
        name:"planet",
        maxZoom:18
      });
      this.map.overlayMapTypes.push(planetTile);
    }
  }
 
2

Comments

3 comments

Please sign in to leave a comment.

Didn't find what you were looking for?

New post