{ "info": { "author": "Yann Forget", "author_email": "yannforget@mailbox.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Topic :: Scientific/Engineering :: GIS" ], "description": "# OSMxtract\n\n## Description\n\n**OSMxtract** is a simple Python package that uses the [Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API) to fetch [OpenStreetMap](https://www.openstreetmap.org) features and export them in a GeoJSON file.\n\n## Installation\n\nUsing `pip`:\n\n```sh\npip install osmxtract\n```\n\n## Command-line interface\n\n### Usage\n\n**OSMxtract** can guess the extent of your query based on three different options:\n\n* `--fromfile`: use the bounds from the input vector or raster file ;\n* `--latlon` and `--buffer`: use the bounds of a buffer around a given point ;\n* `--address` and `--buffer`: use the bounds of a buffer around a geocoded address.\n\n```\nUsage: osmxtract [OPTIONS] OUTPUT\n\n Extract GeoJSON features from OSM with the Overpass API.\n\nOptions:\n --fromfile PATH Bounding box from input file.\n --latlon FLOAT... Space-separated lat/lon coordinates.\n --address TEXT Address to geocode.\n --buffer INTEGER Buffer size in meters around lat/lon or\n address.\n --tag TEXT OSM tag of interest (ex: \"highway\").\n --values TEXT Comma-separated list of possible values (ex:\n \"tertiary,primary\").\n --case-insensitive Make the first character of each value case\n insensitive.\n --geom [point|linestring|polygon|multipolygon]\n Output geometry type.\n --help Show this message and exit.\n```\n\n### Examples\n\n```bash\n# buildings around the \"Universit\u00e9 Libre de Bruxelles\" as polygons\n# save features in the file `buildings.geojson`. since no values\n# are provided, all non-null values are accepted for the tag\n# \"highway\" are accepted.\nosmxtract --address \"Universit\u00e9 Libre de Bruxelles\" --buffer 5000 \\\n --tag building --geom polygon buildings.geojson\n\n# primary, secondary and tertiary roads based on the extent\n# of an existing raster. save the result as linestrings in the\n# `major_roads.geojson` file. we use the `--case-insensitive`\n# flag to get roads tagged as \"primary\" as well as \"Primary\".\nosmxtract --fromfile map.tif --tag highway \\\n --values \"primary,secondary,tertiary\" \\\n --case-insensitive --geom linestring \\\n major_roads.geojson\n\n# cafes and bars near \"Atomium, Brussels\" \nosmxtract --address \"atomium, brussels\" --buffer 1000 \\\n --tag amenity --values \"cafe,bar\" --geom point \\\n cafes_and_bars.geojson\n```\n\n## API\n\n\n\n``` python\nimport json\nfrom osmxtract import overpass, location\nimport geopandas as gpd\n\n# Get bounding box coordinates from a 2km buffer\n# around the Atomium in Brussels\nlat, lon = location.geocode('Atomium, Brussels')\nbounds = location.from_buffer(lat, lon, buffer_size=2000)\n\n# Build an overpass QL query and get the JSON response\nquery = overpass.ql_query(bounds, tag='amenity', values=['cafe', 'bar'])\nresponse = overpass.request(query)\n\n# Process response manually...\nfor elem in response['elements']:\n print(elem['tags'].get('name'))\n\n#\u00a0Output:\n# Au Bon Coin\n# Aux 4 Coins du Monde\n# Excelsior\n# Welcome II\n# Heymbos\n# Games Caf\u00e9\n# Stadium\n# Le Beau Rivage\n# The Corner\n# None\n# Expo\n# Koning\n# Centrum\n# St. Amands\n# Bij Manu\n\n# ...or parse them as GeoJSON\nfeature_collection = overpass.as_geojson(response, 'point')\n\n# Write as GeoJSON\nwith open('cafes_and_bars.geojson', 'w') as f:\n json.dump(feature_collection, f)\n\n# To GeoPandas GeoDataFrame:\ngeodataframe = gpd.GeoDataFrame.from_features(feature_collection)\n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/yannforget/osmxtract", "keywords": "earth observation,gis,openstreetmap", "license": "", "maintainer": "", "maintainer_email": "", "name": "osmxtract", "package_url": "https://pypi.org/project/osmxtract/", "platform": "", "project_url": "https://pypi.org/project/osmxtract/", "project_urls": { "Homepage": "https://github.com/yannforget/osmxtract" }, "release_url": "https://pypi.org/project/osmxtract/0.0.1/", "requires_dist": [ "requests", "click", "pyproj", "geojson", "shapely", "fiona", "rasterio", "geopy", "tqdm", "appdirs" ], "requires_python": "", "summary": "Extract vector and raster data from OSM.", "version": "0.0.1" }, "last_serial": 3955082, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4c75f9686187e3f7aa444d195d2bc607", "sha256": "3a813c475377fadcf4a62ec48052d44bc56b5ffb0c056b026a59ff7c94f1feef" }, "downloads": -1, "filename": "osmxtract-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4c75f9686187e3f7aa444d195d2bc607", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8575, "upload_time": "2018-06-12T19:24:52", "url": "https://files.pythonhosted.org/packages/0b/68/62ca532b56a4548eeb78f9be4396e58a8c5d927d8aedba7711159e419211/osmxtract-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c1e0ac65673c244d3a313bb0a70f57b", "sha256": "1d81d413e06079500d29587fdff0c0e2ad3e30ef5333ea3db03517f1e7d14bba" }, "downloads": -1, "filename": "osmxtract-0.0.1.tar.gz", "has_sig": false, "md5_digest": "0c1e0ac65673c244d3a313bb0a70f57b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7865, "upload_time": "2018-06-12T19:24:53", "url": "https://files.pythonhosted.org/packages/08/30/b230da48e6674d3f5bb6e171f3e1e947e4635fdf5b83b3cfbbdf84631509/osmxtract-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4c75f9686187e3f7aa444d195d2bc607", "sha256": "3a813c475377fadcf4a62ec48052d44bc56b5ffb0c056b026a59ff7c94f1feef" }, "downloads": -1, "filename": "osmxtract-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4c75f9686187e3f7aa444d195d2bc607", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8575, "upload_time": "2018-06-12T19:24:52", "url": "https://files.pythonhosted.org/packages/0b/68/62ca532b56a4548eeb78f9be4396e58a8c5d927d8aedba7711159e419211/osmxtract-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c1e0ac65673c244d3a313bb0a70f57b", "sha256": "1d81d413e06079500d29587fdff0c0e2ad3e30ef5333ea3db03517f1e7d14bba" }, "downloads": -1, "filename": "osmxtract-0.0.1.tar.gz", "has_sig": false, "md5_digest": "0c1e0ac65673c244d3a313bb0a70f57b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7865, "upload_time": "2018-06-12T19:24:53", "url": "https://files.pythonhosted.org/packages/08/30/b230da48e6674d3f5bb6e171f3e1e947e4635fdf5b83b3cfbbdf84631509/osmxtract-0.0.1.tar.gz" } ] }