Skip to content

Commit

Permalink
Merge pull request #11 from GeoscienceAustralia/feat/dispatcher_notebook
Browse files Browse the repository at this point in the history
#8 Add reprojection code
  • Loading branch information
Tisham Dhar authored May 27, 2021
2 parents 867f8af + 113da6b commit 1179b6c
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions wps_dispatcher/notebooks/WIT_WPS_Dispatcher.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"metadata": {},
"outputs": [],
"source": [
"import osgeo.ogr as ogr\n",
"import osgeo.ogr as ogr, osr\n",
"from tqdm import tqdm"
]
},
Expand All @@ -34,14 +34,28 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "6de28833",
"metadata": {},
"outputs": [],
"source": [
"inSpatialRef = osr.SpatialReference()\n",
"inSpatialRef.ImportFromEPSG(3577)\n",
"outSpatialRef = osr.SpatialReference()\n",
"outSpatialRef.ImportFromEPSG(4326)\n",
"coordTrans = osr.CoordinateTransformation(inSpatialRef, outSpatialRef)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "7f509211",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 270421/270421 [09:42<00:00, 464.35it/s] \n"
"100%|██████████| 270421/270421 [01:16<00:00, 3532.45it/s]\n"
]
}
],
Expand All @@ -50,8 +64,17 @@
"feature_n = layer.GetFeatureCount()\n",
"for feature in tqdm(layer):\n",
" geom = feature.GetGeometryRef()\n",
" geom.Transform(coordTrans)\n",
" centroid = geom.Centroid().ExportToWkt()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f7dbe6af",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -70,7 +93,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 1179b6c

Please sign in to comment.