{ "info": { "author": "Nicola Simboli", "author_email": "support@simboli.eu", "bugtrack_url": null, "classifiers": [], "description": "\n# geoClassy\n\nThe geoClassy package was developed from the need of using GeoJSON files with [OpenStreetMap data](https://wiki.openstreetmap.org/wiki/Downloading_data) to classify points which GPS coordinates are known. Using the GeoJSON format as input, the package can also be used with files from sources different from OpenStreetMap.\n\nExamples of use:\n\n* find the neighborhood of the city with most AirBnB beds;\n* classification of customers by key account area of competence;\n* filter of road accidents in a certain province;\n* assessment of the air quality for a specific Municipality;\n* list of cities affected by the passage of an hurricane.\n\n# Contact\n\nIf you wish to contact the author of this module you can just send an e-mail to *support@simboli.eu*.\nIf you want to read the lastest news about this package you can stay connected with the [Simboli.EU](http://www.simboli.eu/) blog.\n\n# Changelog\n\n## Version 0.0.5 (beta)\n\n* Small code diet;\n* Added project documentation.\n\n## Version 0.0.4 (beta)\n\nFist downloadable version:\n* Project added to [PyPI](https://pypi.org/project/geoClassy/)\n\n## Versions <= 0.0.3\n\nTest versions used for debugs and primary tests.\n\n# Data sources\n\nThe module was designed to accept as input the GeoJSON files from the OpenStreetMap database. This data can be extracted in several ways, some of my favourites are the following:\n\n- GeoJSON page downloaded from Simboli.eu;\n- Overpass-Turbo;\n- Polygons OpenStreetMap FR.\n\n## GeoJSON page on this web site\n\nThat\u2019s the easiest way to download a complete and ready to use file geoJSON to feed the geoClassy package. All available geoJSON files can be found on [this page](http://www.simboli.eu/geojson-file/). If you need some specific files just mail me and I\u2019ll try to help you.\n\n## Overpass-Turbo\n\nThis is a powerful tool and I can say that it is one of the best tool you can learn if you want to work in the data science using geographical data. The platform can be found on [this page](https://overpass-turbo.eu/) where there is also a useful Query Wizard for those who are using the tool for their first times.\nQuery should be written in Overpass XML or Overpass QL, a getting [started guide](https://wiki.openstreetmap.org/wiki/Overpass_API) and [examples cookbook](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example) are provided from OpenStreetMap.\n\n## Polygons OpenStreetMap FR\n\nIf you are a data nerd (and probably you are if you are using this package \ud83d\ude42 ) you could think about including in your projects [this direct link](https://peteris.rocks/blog/openstreetmap-administrative-boundaries-in-geojson/) to execute Overpass queries. Please note that the linked tutorial shows how to extract data in JSON, you also have to convert it in geoJSON if you want to use with geoClassy.\n\n# Requirements\n\nThe module, to work properly, requires that the Shapely module and the Json module have also been installed.\n\nIf don\u2019t have them, you have to install them before continue. Json is a build-in package so your Python installation should already include it, Shapely could be downloaded by its [Pypi page](https://pypi.org/project/Shapely/).\n\n# Installation\n\nAs most of the Python modules, geoClassy can be [installated](https://pypi.org/project/geoClassy/) with the easy PIP installer, just using the following: `pip install geoClassy`\n\n# Import\n\nThe best way to import this module is the following\n\n\n```python\nfrom geoClassy import single as gCs\n```\n\n# Usage ot the geoClassy package\n\n## requisites()\n\nThis methods does not accept any parameters and try to import Shapely and JSON package as they are needed to use geoClassy module.\n\n\n```python\ngCs.requisites()\n```\n\n Json module correctly imported\n Shapely Geometry module correctly imported\n\n\n## loadFile(fname)\n\nThis methods is the first to use in the program as it read the geoJSON file (the path should be stored into a variable fname or write directly between the two braches) and build n polygons for every closed area defined in the file.\n\nIf the GeoJSON file is in the same folder where the Python script is saved you can use only the filename:\n\n\n```python\nGEOJSON_PATH='USA New York City neightborhoods 20190127.geojson'\ngCs.loadFile(GEOJSON_PATH)\n```\n\notherwise you can specify the complete path:\n\n\n```python\nGEOJSON_PATH='/home/Paul/geoClassy_documentation/USA New York City neightborhoods 20190127.geojson'\ngCs.loadFile(GEOJSON_PATH)\n```\n\n## numPoly()\n\nIt simply shows the number of polygons that are being imported into our systems.\n\n\n```python\ngCs.numPoly()\n```\n\n 55 polygons loaded\n\n\n## checkPoly()\n\nThis methods print the list of polygons loaded in the LoadFile step and print if they are valid or not.\n\n\n```python\ngCs.checkPoly()\n```\n\n Polygon 0 : Marble Hill\n ok\n Polygon 1 : Times Square\n ok\n Polygon 2 : Flatiron District\n ok\n Polygon 3 : Inwood\n ok\n Polygon 4 : Fort George\n ok\n Polygon 5 : Hudson Heights\n ok\n Polygon 6 : Washington Heights\n ok\n Polygon 7 : Sugar Hill\n ok\n Polygon 8 : Hamilton Heights\n ok\n Polygon 9 : Manhattanville\n ok\n Polygon 10 : Morningside Heights\n ok\n Polygon 11 : Manhattan Valley\n ok\n Polygon 12 : Harlem\n ok\n Polygon 13 : East Harlem\n ok\n Polygon 14 : Carnegie Hill\n ok\n Polygon 15 : Yorkville\n ok\n Polygon 16 : Upper West Side\n ok\n Polygon 17 : Lincoln Square\n ok\n Polygon 18 : Columbus Circle\n ok\n Polygon 19 : Upper East Side\n ok\n Polygon 20 : Lenox Hill\n ok\n Polygon 21 : Midtown\n ok\n Polygon 22 : Midtown East\n ok\n Polygon 23 : Turtle Bay\n ok\n Polygon 24 : Tudor City\n ok\n Polygon 25 : Murray Hill\n ok\n Polygon 26 : Hudson Yards\n ok\n Polygon 27 : Hell's Kitchen\n ok\n Polygon 28 : Garment District\n ok\n Polygon 29 : Herald Square\n ok\n Polygon 30 : Koreatown\n ok\n Polygon 31 : Midtown South\n ok\n Polygon 32 : NoMad\n ok\n Polygon 33 : Rose Hill\n ok\n Polygon 34 : Kips Bay\n ok\n Polygon 35 : Stuy Town\n ok\n Polygon 36 : Gramercy\n ok\n Polygon 37 : Union Square\n ok\n Polygon 38 : Chelsea\n ok\n Polygon 39 : Meatpacking District\n ok\n Polygon 40 : Alphabet City\n ok\n Polygon 41 : East Village\n ok\n Polygon 42 : NoHo\n ok\n Polygon 43 : Greenwich Village\n ok\n Polygon 44 : West Village\n ok\n Polygon 45 : Hudson Square\n ok\n Polygon 46 : SoHo\n ok\n Polygon 47 : Little Italy\n ok\n Polygon 48 : Lower East Side\n ok\n Polygon 49 : Chinatown\n ok\n Polygon 50 : TriBeCa\n ok\n Polygon 51 : Civic Center\n ok\n Polygon 52 : Two Bridges\n ok\n Polygon 53 : Financial District\n ok\n Polygon 54 : Battery Park City\n ok\n\n\n## polyList()\n\nThis method print all the polygons that are stored in the GeoJSON file.\n\n\n```python\ngCs.polyList()\n```\n\n\n\n\n ['Marble Hill',\n 'Times Square',\n 'Flatiron District',\n 'Inwood',\n 'Fort George',\n 'Hudson Heights',\n 'Washington Heights',\n 'Sugar Hill',\n 'Hamilton Heights',\n 'Manhattanville',\n 'Morningside Heights',\n 'Manhattan Valley',\n 'Harlem',\n 'East Harlem',\n 'Carnegie Hill',\n 'Yorkville',\n 'Upper West Side',\n 'Lincoln Square',\n 'Columbus Circle',\n 'Upper East Side',\n 'Lenox Hill',\n 'Midtown',\n 'Midtown East',\n 'Turtle Bay',\n 'Tudor City',\n 'Murray Hill',\n 'Hudson Yards',\n \"Hell's Kitchen\",\n 'Garment District',\n 'Herald Square',\n 'Koreatown',\n 'Midtown South',\n 'NoMad',\n 'Rose Hill',\n 'Kips Bay',\n 'Stuy Town',\n 'Gramercy',\n 'Union Square',\n 'Chelsea',\n 'Meatpacking District',\n 'Alphabet City',\n 'East Village',\n 'NoHo',\n 'Greenwich Village',\n 'West Village',\n 'Hudson Square',\n 'SoHo',\n 'Little Italy',\n 'Lower East Side',\n 'Chinatown',\n 'TriBeCa',\n 'Civic Center',\n 'Two Bridges',\n 'Financial District',\n 'Battery Park City']\n\n\n\nYou can also use to make a list of the polygons:\n\n\n```python\nNames=gCs.polyList()\nprint(Names)\n```\n\n ['Marble Hill', 'Times Square', 'Flatiron District', 'Inwood', 'Fort George', 'Hudson Heights', 'Washington Heights', 'Sugar Hill', 'Hamilton Heights', 'Manhattanville', 'Morningside Heights', 'Manhattan Valley', 'Harlem', 'East Harlem', 'Carnegie Hill', 'Yorkville', 'Upper West Side', 'Lincoln Square', 'Columbus Circle', 'Upper East Side', 'Lenox Hill', 'Midtown', 'Midtown East', 'Turtle Bay', 'Tudor City', 'Murray Hill', 'Hudson Yards', \"Hell's Kitchen\", 'Garment District', 'Herald Square', 'Koreatown', 'Midtown South', 'NoMad', 'Rose Hill', 'Kips Bay', 'Stuy Town', 'Gramercy', 'Union Square', 'Chelsea', 'Meatpacking District', 'Alphabet City', 'East Village', 'NoHo', 'Greenwich Village', 'West Village', 'Hudson Square', 'SoHo', 'Little Italy', 'Lower East Side', 'Chinatown', 'TriBeCa', 'Civic Center', 'Two Bridges', 'Financial District', 'Battery Park City']\n\n\n## getNames(lat, lon)\n\nIt shows the name of the polygons which contains the point (latitude, longitude) is. If the point is outside every polygon unknown is printed.\n\n\n```python\n# Empire State Building\ngCs.getNames(40.748417,-73.985833)\n```\n\n\n\n\n 'Midtown South'\n\n\n\nThis method could be used also with Pandas Dataframe:\n\n\n```python\nimport pandas as pd\nimport numpy as np\ndf = pd.DataFrame(np.array([['Ghostbusters Firehouse',40.719646, -74.006297], ['New York Public Library', 40.752042, -73.993447],['White house',38.8976998, -77.0365535]]),columns=['description', 'latitude', 'longitude'])\ndf\n```\n\n\n\n\n
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
descriptionlatitudelongitude
0Ghostbusters Firehouse40.719646-74.006297
1New York Public Library40.752042-73.993447
2White house38.8976998-77.0365535
\n
\n\n\n\n\n```python\ndf['zone'] = df.apply(lambda row: gCs.getNames(pd.to_numeric(row.latitude), pd.to_numeric(row.longitude)), axis=1)\ndf\n```\n\n\n\n\n
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
descriptionlatitudelongitudezone
0Ghostbusters Firehouse40.719646-74.006297TriBeCa
1New York Public Library40.752042-73.993447Chelsea
2White house38.8976998-77.0365535unknown
\n
\n\n\n\n> last revision of this document: 2019-02-10\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://www.simboli.eu/", "keywords": "geoJson,Open Street Map,gps,shapely", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "geoClassy", "package_url": "https://pypi.org/project/geoClassy/", "platform": "", "project_url": "https://pypi.org/project/geoClassy/", "project_urls": { "Homepage": "https://www.simboli.eu/" }, "release_url": "https://pypi.org/project/geoClassy/0.0.7/", "requires_dist": null, "requires_python": "", "summary": "a classificator of GPS point over geoJson areas", "version": "0.0.7" }, "last_serial": 4803155, "releases": { "0.0.4": [ { "comment_text": "", "digests": { "md5": "87a95f5f3426d097aa57210f6283092c", "sha256": "0b03aaa34b54c3772f0b8ff77b366f35104de03d95fe7049ef352e0d59325879" }, "downloads": -1, "filename": "geoClassy-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "87a95f5f3426d097aa57210f6283092c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3320, "upload_time": "2019-02-05T19:27:16", "url": "https://files.pythonhosted.org/packages/bc/d1/199cdbe38e9238cbd8999f6ca9398636dab5a0ec6f57414671948466d09a/geoClassy-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2102430c9efe5abb84c73f11f24696c8", "sha256": "5efb1d3730cf7f0861d1d66902a9773da2d4fefe9197f93dfa54679be65df51c" }, "downloads": -1, "filename": "geoClassy-0.0.4.tar.gz", "has_sig": false, "md5_digest": "2102430c9efe5abb84c73f11f24696c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1885, "upload_time": "2019-02-05T19:27:18", "url": "https://files.pythonhosted.org/packages/d5/18/3c38d3f00fbb7c0971dbb681d572adf22708428c73437b8326780e17a526/geoClassy-0.0.4.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "435636bdfb4bee7f6d5800f77aec2d28", "sha256": "e5aaa4cd8c04415807d16eb6814bc6fd17a4a5c18a3b640cf7a4ab7376212358" }, "downloads": -1, "filename": "geoClassy-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "435636bdfb4bee7f6d5800f77aec2d28", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6803, "upload_time": "2019-02-10T19:57:19", "url": "https://files.pythonhosted.org/packages/eb/c5/c55a46b625308760e57007bac3c64519be937d3dbcf9ec0a1680f01e66a8/geoClassy-0.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bc264b928d86fbfd1eb877ad2d68dd4d", "sha256": "0e9bd98cffd4f540caefccf092c1f61c3a24e87c628de1332454757a76909804" }, "downloads": -1, "filename": "geoClassy-0.0.7.tar.gz", "has_sig": false, "md5_digest": "bc264b928d86fbfd1eb877ad2d68dd4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6683, "upload_time": "2019-02-10T19:57:21", "url": "https://files.pythonhosted.org/packages/51/29/14cef63bd9e212aaa9ad0eeea16d578ba8c79f7e7e12c42ab698babb3b74/geoClassy-0.0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "435636bdfb4bee7f6d5800f77aec2d28", "sha256": "e5aaa4cd8c04415807d16eb6814bc6fd17a4a5c18a3b640cf7a4ab7376212358" }, "downloads": -1, "filename": "geoClassy-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "435636bdfb4bee7f6d5800f77aec2d28", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6803, "upload_time": "2019-02-10T19:57:19", "url": "https://files.pythonhosted.org/packages/eb/c5/c55a46b625308760e57007bac3c64519be937d3dbcf9ec0a1680f01e66a8/geoClassy-0.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bc264b928d86fbfd1eb877ad2d68dd4d", "sha256": "0e9bd98cffd4f540caefccf092c1f61c3a24e87c628de1332454757a76909804" }, "downloads": -1, "filename": "geoClassy-0.0.7.tar.gz", "has_sig": false, "md5_digest": "bc264b928d86fbfd1eb877ad2d68dd4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6683, "upload_time": "2019-02-10T19:57:21", "url": "https://files.pythonhosted.org/packages/51/29/14cef63bd9e212aaa9ad0eeea16d578ba8c79f7e7e12c42ab698babb3b74/geoClassy-0.0.7.tar.gz" } ] }