Google Cloud
PMTiles can be served from a Cloud Run container using the go-pmtiles Docker image.
Cloud Storage
The Cloud Run container is designed to work with existing Cloud Storage buckets.
If you need to create a new Bucket:
Choose + Create in the Cloud Storage console.
Pick a globally unique name for your bucket.
For Location Type, choose Region: Lowest latency within a single region and make a region choice.
Leave Storage Class and Prevent Public Access as the defaults.
Uncheck Data Protection > Soft Delete Policy.
Upload a sample PMTiles into your bucket. File names must include only S3 safe characters.
Creating a Cloud Run container
In the Cloud Run console, choose Create Service.
Choose Deploy one revision from an existing container image.
Specify the Container image URL
protomaps/go-pmtiles:v1.22.1
.Choose a descriptive Service name like
protomaps-demo
.Select the same Region as your Cloud Storage bucket.
Select Allow unauthenticated invocations.
For CPU Allocation Service Autoscaling, leave the defaults (only allocated during processing + 0 minimum instances).
Under Container(s), Volumes, Networking, Security:
Leave the default container port (8080).
Leave the container command blank (default entry point)
Specify the arguments:
serve . --bucket=gs://BUCKET --cache-size=500 --public-url=https://example.com
replacingBUCKET
with the name of your bucket andhttps://example.com
with your custom domain. (You may need to enter this manually in the Console for it to interpret spaces correctly.)Set
Memory
to 1 GiB.Change Execution Environment to 2nd Generation.
Set Maximum Number of Instances to 1.
By default, Cloud Run projects in the same Project as the Storage bucket will create a Service Account to authenticate to the bucket.
You should now be able to access your tileset at these URLs:
https://EXAMPLE.REGION.run.app/TILESET/0/0/0.mvt
https://EXAMPLE.REGION.run.app/TILESET.json # TileJSON,requires --public-url to be set
https://EXAMPLE.REGION.run.app/TILESET/0/0/0.mvt
https://EXAMPLE.REGION.run.app/TILESET.json # TileJSON,requires --public-url to be set
Edge caching can be configured through Google Cloud CDN in front of this Cloud Run URL.