Skip to content

Commit

Permalink
Add GitHub Actions for checking PR file size
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Sep 10, 2023
1 parent 3d5235c commit 5f1b179
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 285 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/check_file_size.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Check Pull Request File Size

on:
pull_request:
paths:
- "**"

jobs:
check_file_size:
runs-on: ubuntu-latest

steps:
- name: Check File Size
id: check_file_size
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Get Changed Files
id: get_changed_files
run: |
echo "::set-output name=changed_files::$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})"
shell: bash

- name: Check File Size
id: check_size
run: |
for file in ${{ steps.get_changed_files.outputs.changed_files }}; do
file_size=$(stat -c %s "$file")
if [ $file_size -gt 2000000 ]; then
echo "File $file exceeds the 2MB limit with a size of $(($file_size / 1000000)) MB"
exit 1
fi
done
shell: bash
151 changes: 13 additions & 138 deletions docs/notebooks/74_map_tiles_to_geotiff.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -28,7 +28,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -44,24 +44,9 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "64179897fd044c98a924b5fc03c04dc7",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"m = leafmap.Map()\n",
"m"
Expand All @@ -76,7 +61,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -90,87 +75,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Download TMS tiles and create a GeoTIFF file. First, let's try OpenStreetMap."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Downloaded image 1/15\n",
"Downloaded image 2/15\n",
"Downloaded image 3/15\n",
"Downloaded image 4/15\n",
"Downloaded image 5/15\n",
"Downloaded image 6/15\n",
"Downloaded image 7/15\n",
"Downloaded image 8/15\n",
"Downloaded image 9/15\n",
"Downloaded image 10/15\n",
"Downloaded image 11/15\n",
"Downloaded image 12/15\n",
"Downloaded image 13/15\n",
"Downloaded image 14/15\n",
"Downloaded image 15/15\n",
"Saving GeoTIFF. Please wait...\n",
"Image saved to osm.tif\n"
]
}
],
"source": [
"leafmap.map_tiles_to_geotiff('osm.tif', bbox, zoom=13, source='OpenStreetMap', quiet=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](https://i.imgur.com/ft597DD.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Try Google Satellite."
"Download map tiles and create a GeoTIFF file. First, let's try Esri world imagery basemap."
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "fd118011",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Downloaded image 1/15\n",
"Downloaded image 2/15\n",
"Downloaded image 3/15\n",
"Downloaded image 4/15\n",
"Downloaded image 5/15\n",
"Downloaded image 6/15\n",
"Downloaded image 7/15\n",
"Downloaded image 8/15\n",
"Downloaded image 9/15\n",
"Downloaded image 10/15\n",
"Downloaded image 11/15\n",
"Downloaded image 12/15\n",
"Downloaded image 13/15\n",
"Downloaded image 14/15\n",
"Downloaded image 15/15\n",
"Saving GeoTIFF. Please wait...\n",
"Image saved to satellite.tif\n"
]
}
],
"outputs": [],
"source": [
"leafmap.map_tiles_to_geotiff('satellite.tif', bbox, zoom=13, source='Satellite')"
"leafmap.map_tiles_to_geotiff('satellite.tif', bbox, zoom=13, source='Esri.WorldImagery')"
]
},
{
Expand All @@ -180,53 +95,13 @@
"![](https://i.imgur.com/ILYunA9.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Try OpenTopoMap."
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"source = 'https://a.tile.opentopomap.org/{z}/{x}/{y}.png'"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Downloaded image 1/15\n",
"Downloaded image 2/15\n",
"Downloaded image 3/15\n",
"Downloaded image 4/15\n",
"Downloaded image 5/15\n",
"Downloaded image 6/15\n",
"Downloaded image 7/15\n",
"Downloaded image 8/15\n",
"Downloaded image 9/15\n",
"Downloaded image 10/15\n",
"Downloaded image 11/15\n",
"Downloaded image 12/15\n",
"Downloaded image 13/15\n",
"Downloaded image 14/15\n",
"Downloaded image 15/15\n",
"Saving GeoTIFF. Please wait...\n",
"Image saved to topo.tif\n"
]
}
],
"source": [
"leafmap.map_tiles_to_geotiff('topo.tif', bbox, zoom=13, source=source)"
"leafmap.map_tiles_to_geotiff('topo.tif', bbox, zoom=13, source='OpenTopoMap')"
]
},
{
Expand All @@ -253,7 +128,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.8"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 5f1b179

Please sign in to comment.