Skip to content

Commit

Permalink
fix: update notebooks to reflect the refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurdjn committed Jun 12, 2024
1 parent c553f68 commit 09cab48
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 177 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### New Contributors

## 0.1.0 (2024-06-12)

### What's Changed

#### Fixed

- Updated version to 0.0.1 to 0.1.0 for PyPI release.

#### Added

#### Changed

- Renamed and restructured some endpoints / methods to share a similar structure.
(e.g. `get_workspace(workspace: str)` -> `get_workspace(name: str)`, `get_layer(layer: str)` -> `get_layer(name: str)`)
- Updated documentation and examples to reflect the changes.

#### Removed

### New Contributors

## 0.0.1 (2024-06-06)

### What's Changed
Expand Down
2 changes: 1 addition & 1 deletion geoserver/geoserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ def create_feature_type(
Args:
body: The body of the request used to create the feature type.
workspace: The name of the workspace.
store: The name of the data store.
store: Optional. The name of the data store.
Returns:
Success message.
Expand Down
72 changes: 36 additions & 36 deletions notebooks/All In One.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
"metadata": {},
"outputs": [],
"source": [
"if geoserver.workspace_exists(workspace=\"demo\"):\n",
" geoserver.delete_workspace(workspace=\"demo\", recurse=True)"
"if geoserver.workspace_exists(\"demo\"):\n",
" geoserver.delete_workspace(\"demo\", recurse=True)"
]
},
{
Expand Down Expand Up @@ -200,7 +200,7 @@
"text/plain": [
"{'workspace': {'name': 'demo',\n",
" 'isolated': False,\n",
" 'dateCreated': '2024-06-11 20:50:39.223 UTC',\n",
" 'dateCreated': '2024-06-12 22:29:47.282 UTC',\n",
" 'dataStores': 'http://localhost:8080/geoserver/rest/workspaces/demo/datastores.json',\n",
" 'coverageStores': 'http://localhost:8080/geoserver/rest/workspaces/demo/coveragestores.json',\n",
" 'wmsStores': 'http://localhost:8080/geoserver/rest/workspaces/demo/wmsstores.json',\n",
Expand All @@ -213,7 +213,7 @@
}
],
"source": [
"geoserver.get_workspace(workspace=\"demo\")"
"geoserver.get_workspace(\"demo\")"
]
},
{
Expand Down Expand Up @@ -248,7 +248,7 @@
"body = \"<workspace><name>demo</name><enabled>true</enabled></workspace>\"\n",
"\n",
"\n",
"geoserver.update_workspace(body=body, workspace=\"demo\")"
"geoserver.update_workspace(\"demo\", body=body)"
]
},
{
Expand Down Expand Up @@ -589,8 +589,8 @@
" {'@key': 'url',\n",
" '$': 'file:/opt/geoserver/data_dir/data/demo/buildings/buildings.shp'}]},\n",
" '_default': False,\n",
" 'dateCreated': '2024-06-11 20:50:39.320 UTC',\n",
" 'dateModified': '2024-06-11 20:50:39.331 UTC',\n",
" 'dateCreated': '2024-06-12 22:29:47.368 UTC',\n",
" 'dateModified': '2024-06-12 22:29:47.377 UTC',\n",
" 'disableOnConnFailure': False,\n",
" 'featureTypes': 'http://localhost:8080/geoserver/rest/workspaces/demo/datastores/buildings/featuretypes.json'}}"
]
Expand Down Expand Up @@ -783,8 +783,8 @@
" 'workspace': {'name': 'demo',\n",
" 'href': 'http://localhost:8080/geoserver/rest/workspaces/demo.json'},\n",
" '_default': False,\n",
" 'dateCreated': '2024-06-11 20:50:39.872 UTC',\n",
" 'dateModified': '2024-06-11 20:50:39.898 UTC',\n",
" 'dateCreated': '2024-06-12 22:29:47.909 UTC',\n",
" 'dateModified': '2024-06-12 22:29:47.928 UTC',\n",
" 'disableOnConnFailure': False,\n",
" 'url': 'file:data/demo/raster/raster.tif',\n",
" 'coverages': 'http://localhost:8080/geoserver/rest/workspaces/demo/coveragestores/raster/coverages.json'}}"
Expand Down Expand Up @@ -943,26 +943,26 @@
" 'translateX': -1.5140908372979216,\n",
" 'translateY': 48.638061247682344},\n",
" 'crs': 'EPSG:4326'},\n",
" 'supportedFormats': {'string': ['GEOTIFF',\n",
" 'ERDASImg',\n",
" 'RST',\n",
" 'GeoPackage (mosaic)',\n",
" 'supportedFormats': {'string': ['GIF',\n",
" 'PNG',\n",
" 'JPEG',\n",
" 'TIFF',\n",
" 'NetCDF',\n",
" 'ENVIHdr',\n",
" 'ArcGrid',\n",
" 'NITF',\n",
" 'RPFTOC',\n",
" 'VRT',\n",
" 'EHdr',\n",
" 'ImagePyramid',\n",
" 'VRT',\n",
" 'GEOTIFF',\n",
" 'DTED',\n",
" 'ArcGrid',\n",
" 'RST',\n",
" 'GeoPackage (mosaic)',\n",
" 'ImageMosaic',\n",
" 'AIG',\n",
" 'SRP',\n",
" 'GIF',\n",
" 'PNG',\n",
" 'JPEG',\n",
" 'TIFF']},\n",
" 'ENVIHdr',\n",
" 'ERDASImg',\n",
" 'ImagePyramid',\n",
" 'AIG',\n",
" 'RPFTOC',\n",
" 'NITF']},\n",
" 'interpolationMethods': {'string': ['nearest neighbor',\n",
" 'bilinear',\n",
" 'bicubic']},\n",
Expand Down Expand Up @@ -1019,7 +1019,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 25,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1057,7 +1057,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 26,
"metadata": {},
"outputs": [
{
Expand All @@ -1075,7 +1075,7 @@
}
],
"source": [
"geoserver.get_style(style=\"point\")"
"geoserver.get_style(\"point\")"
]
},
{
Expand All @@ -1093,7 +1093,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 27,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1121,7 +1121,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 28,
"metadata": {},
"outputs": [
{
Expand All @@ -1145,7 +1145,7 @@
" body = file.read()\n",
"\n",
" \n",
"geoserver.update_style(style=\"elevation\", body=body, workspace=\"demo\")"
"geoserver.update_style(\"elevation\", body=body, workspace=\"demo\")"
]
},
{
Expand All @@ -1157,7 +1157,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 29,
"metadata": {},
"outputs": [
{
Expand All @@ -1177,7 +1177,7 @@
"assert file_path.exists(), f\"File not found: {file_path.as_posix()!r}\"\n",
"\n",
"\n",
"geoserver.upload_style(file=file_path, workspace=\"demo\", style=\"elevation_v2\")"
"geoserver.upload_style(file=file_path, workspace=\"demo\", name=\"elevation_v2\")"
]
},
{
Expand All @@ -1191,7 +1191,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 30,
"metadata": {},
"outputs": [
{
Expand All @@ -1215,7 +1215,7 @@
" body = file.read()\n",
"\n",
" \n",
"geoserver.update_style(style=\"elevation\", body=body, workspace=\"demo\")"
"geoserver.update_style(\"elevation\", body=body, workspace=\"demo\")"
]
},
{
Expand All @@ -1229,7 +1229,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 31,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1271,7 +1271,7 @@
}
],
"source": [
"xml = geoserver.download_style(style=\"elevation\", workspace=\"demo\")\n",
"xml = geoserver.download_style(\"elevation\", workspace=\"demo\")\n",
"print(xml)"
]
},
Expand Down
38 changes: 19 additions & 19 deletions notebooks/Image Mosaic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"\n",
"\n",
"# If the store already exists, it will be overwritten\n",
"geoserver.upload_coverage_store(file=file_path, format=\"imagemosaic\", workspace=\"demo\", store=\"polyphemus\")"
"geoserver.upload_coverage_store(file=file_path, format=\"imagemosaic\", workspace=\"demo\", name=\"polyphemus\")"
]
},
{
Expand All @@ -148,7 +148,7 @@
" file=\"file:/path/to/the/file/polyphemus_20130302.nc\", \n",
" format=\"imagemosaic\", \n",
" workspace=\"demo\", \n",
" store=\"poly-incremental\",\n",
" name=\"poly-incremental\",\n",
")\n",
"```\n",
"\n",
Expand All @@ -159,7 +159,7 @@
" file=\"file:/path/to/the/mosaic/folder\", \n",
" format=\"imagemosaic\", \n",
" workspace=\"demo\", \n",
" store=\"poly-incremental\",\n",
" name=\"poly-incremental\",\n",
")\n",
"```"
]
Expand Down Expand Up @@ -271,26 +271,26 @@
" <crs>EPSG:4326</crs>\n",
" </grid>\n",
" <supportedFormats>\n",
" <string>VRT</string>\n",
" <string>ImagePyramid</string>\n",
" <string>EHdr</string>\n",
" <string>GEOTIFF</string>\n",
" <string>RST</string>\n",
" <string>NITF</string>\n",
" <string>ImageMosaic</string>\n",
" <string>RPFTOC</string>\n",
" <string>GIF</string>\n",
" <string>PNG</string>\n",
" <string>JPEG</string>\n",
" <string>TIFF</string>\n",
" <string>ERDASImg</string>\n",
" <string>NetCDF</string>\n",
" <string>GeoPackage (mosaic)</string>\n",
" <string>EHdr</string>\n",
" <string>VRT</string>\n",
" <string>GEOTIFF</string>\n",
" <string>DTED</string>\n",
" <string>ArcGrid</string>\n",
" <string>RST</string>\n",
" <string>GeoPackage (mosaic)</string>\n",
" <string>ImageMosaic</string>\n",
" <string>SRP</string>\n",
" <string>ENVIHdr</string>\n",
" <string>DTED</string>\n",
" <string>ERDASImg</string>\n",
" <string>ImagePyramid</string>\n",
" <string>AIG</string>\n",
" <string>SRP</string>\n",
" <string>RPFTOC</string>\n",
" <string>NITF</string>\n",
" </supportedFormats>\n",
" <interpolationMethods>\n",
" <string>nearest neighbor</string>\n",
Expand Down Expand Up @@ -389,7 +389,7 @@
}
],
"source": [
"xml = geoserver.get_coverage(workspace=\"demo\", store=\"polyphemus\", coverage=\"O3\", format=\"xml\")\n",
"xml = geoserver.get_coverage(name=\"O3\", workspace=\"demo\", store=\"polyphemus\", format=\"xml\")\n",
"print(xml)"
]
},
Expand Down Expand Up @@ -439,7 +439,7 @@
}
],
"source": [
"xml = geoserver.get_coverage_index(workspace=\"demo\", store=\"polyphemus\", coverage=\"O3\", format=\"xml\")\n",
"xml = geoserver.get_coverage_index(name=\"O3\", workspace=\"demo\", store=\"polyphemus\", format=\"xml\")\n",
"print(xml)"
]
},
Expand Down Expand Up @@ -520,7 +520,7 @@
}
],
"source": [
"xml = geoserver.get_coverage_granules(workspace=\"demo\", store=\"polyphemus\", coverage=\"O3\", format=\"xml\")\n",
"xml = geoserver.get_coverage_granules(name=\"O3\", workspace=\"demo\", store=\"polyphemus\", format=\"xml\")\n",
"print(xml)"
]
},
Expand Down Expand Up @@ -550,7 +550,7 @@
}
],
"source": [
"geoserver.delete_coverage_granules(workspace=\"demo\", store=\"polyphemus\", coverage=\"O3\", filter=\"location='polyphemus_20130301.nc'\")"
"geoserver.delete_coverage_granules(name=\"O3\", workspace=\"demo\", store=\"polyphemus\", filter=\"location='polyphemus_20130301.nc'\")"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions notebooks/Layer Groups.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
" 'maxy': 48.638064247,\n",
" 'crs': {'@class': 'org.geotools.referencing.crs.DefaultEngineeringCRS',\n",
" '$': 'EPSG:404000'}},\n",
" 'dateCreated': '2024-06-10 20:30:47.301 UTC'}}"
" 'dateCreated': '2024-06-12 22:31:31.591 UTC'}}"
]
},
"execution_count": 8,
Expand All @@ -262,7 +262,7 @@
}
],
"source": [
"geoserver.get_layer_group(layer_group=\"my_group\", workspace=\"demo\")"
"geoserver.get_layer_group(name=\"my_group\", workspace=\"demo\")"
]
},
{
Expand Down Expand Up @@ -304,7 +304,7 @@
"</layerGroup>\n",
"\"\"\"\n",
"\n",
"geoserver.update_layer_group(body=body, layer_group=\"my_group\", workspace=\"demo\")"
"geoserver.update_layer_group(name=\"my_group\", body=body, workspace=\"demo\")"
]
},
{
Expand Down Expand Up @@ -333,7 +333,7 @@
}
],
"source": [
"geoserver.delete_layer_group(layer_group=\"my_group\", workspace=\"demo\")"
"geoserver.delete_layer_group(name=\"my_group\", workspace=\"demo\")"
]
}
],
Expand Down
Loading

0 comments on commit 09cab48

Please sign in to comment.