{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Usage as a Command Line Interface (CLI)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Once installed, `geoextent` is accessible as acommand line tool. This document is intended to demonstrate the library usage as CLI. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note:**\n", "Depending on the local configuration, geoextent might need to be called with the python interpreter prepended:\n", "*python -m geoextent ...*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A useful way to navigate the library CLI usage is through the help command `-h/--help` which will proivde information about how to use the it, optinal arguments and current supported formats." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "geoextent is a Python library for extracting geospatial and temporal extents of a file or a directory of multiple geospatial data formats.\n", "\n", "usage: geoextent [-h] [-formats] [-b] [-t] [-input= '[filepath|input file]']\n", "\n", "optional arguments:\n", " -h, --help show help message and exit\n", " -formats show supported formats\n", " -b, --bounding-box extract spatial extent (bounding box)\n", " -t, --time-box extract temporal extent\n", " -input= INPUT= [INPUT= ...]\n", " input file or path\n", "\n", "By default, both bounding box and temporal extent are extracted.\n", "\n", "Examples:\n", "\n", "geoextent path/to/geofile.ext\n", "geoextent -b path/to/directory_with_geospatial_data\n", "geoextent -t path/to/file_with_temporal_extent\n", "geoextent -b -t path/to/geospatial_files\n", "\n", "\n", "Supported formats:\n", "- GeoJSON (.geojson)\n", "- Tabular data (.csv)\n", "- Shapefile (.shp)\n", "- GeoTIFF (.geotiff, .tif)\n", "\n" ] } ], "source": [ "python3 -m geoextent --help" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The following examble shows how to extract bounding box from a single file" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note:**\n", "You can find the file used in the examples of this section from [muenster_ring_zeit](https://raw.githubusercontent.com/o2r-project/geoextent/master/tests/testdata/geojson/muenster_ring_zeit.geojson). Furthermore, for displaying the rendering of the file contents, see [rendered blob](https://github.com/o2r-project/geoextent/blob/master/tests/testdata/geojson/muenster_ring_zeit.geojson).\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ERROR:geoextent.lib.extent:\n", "{'format': 'application/geojson', 'crs': 4326, 'bbox': [7.60168075561523, 51.9488147720619, 7.64725685119629, 51.9746240298775]}\n" ] } ], "source": [ "python3 -m geoextent -b -input= 'tests/testdata/geojson/muenster_ring_zeit.geojson'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The following examble shows how to extract time interval from a single file" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'format': 'application/geojson', 'tbox': ['2018-11-14', '2018-11-14']}\n" ] } ], "source": [ "python3 -m geoextent -t -input= 'tests/testdata/geojson/muenster_ring_zeit.geojson'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The following examble shows how to extract box and time interval from a single file" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ERROR:geoextent.lib.extent:\n", "{'format': 'application/geojson', 'crs': 4326, 'tbox': ['2018-11-14', '2018-11-14'], 'bbox': [7.60168075561523, 51.9488147720619, 7.64725685119629, 51.9746240298775]}\n", "ERROR:geoextent.lib.extent:\n" ] } ], "source": [ "python3 -m geoextent -b -t -input= 'tests/testdata/geojson/muenster_ring_zeit.geojson'" ] } ], "metadata": { "kernelspec": { "display_name": "Bash", "language": "bash", "name": "bash" }, "language_info": { "codemirror_mode": "shell", "file_extension": ".sh", "mimetype": "text/x-sh", "name": "bash" } }, "nbformat": 4, "nbformat_minor": 4 }