{"id":24986975,"url":"https://github.com/hitthecodelabs/geospatial-data-analysis","last_synced_at":"2025-03-29T10:47:54.889Z","repository":{"id":270640604,"uuid":"911000642","full_name":"hitthecodelabs/Geospatial-Data-Analysis","owner":"hitthecodelabs","description":"A collection of Python scripts designed for geographical data analysis and visualization","archived":false,"fork":false,"pushed_at":"2025-03-10T19:22:19.000Z","size":73300,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T20:28:51.441Z","etag":null,"topics":["fiona","folium","geopandas","geospatial","gis","kml","kmz","polygon"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hitthecodelabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-02T02:42:02.000Z","updated_at":"2025-03-10T19:22:22.000Z","dependencies_parsed_at":"2025-03-02T00:33:43.376Z","dependency_job_id":null,"html_url":"https://github.com/hitthecodelabs/Geospatial-Data-Analysis","commit_stats":null,"previous_names":["hitthecodelabs/geographicanalysisscripts","hitthecodelabs/geospatial-data-analysis"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hitthecodelabs%2FGeospatial-Data-Analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hitthecodelabs%2FGeospatial-Data-Analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hitthecodelabs%2FGeospatial-Data-Analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hitthecodelabs%2FGeospatial-Data-Analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hitthecodelabs","download_url":"https://codeload.github.com/hitthecodelabs/Geospatial-Data-Analysis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246174532,"owners_count":20735413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fiona","folium","geopandas","geospatial","gis","kml","kmz","polygon"],"created_at":"2025-02-04T11:34:47.555Z","updated_at":"2025-03-29T10:47:49.878Z","avatar_url":"https://github.com/hitthecodelabs.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Geospatial Data Analysis\n\n![Map](./images/chimborazo_elevation_map.png)\n\n![Map](./images/stad.png)\n\n![Map](./images/map_polygon_satellite_view.png)\n\n![Map](./images/coropletic_map_barcelona.png)\n\n## Overview\nThis repository contains a collection of Python scripts designed for geographical data analysis and visualization. These tools provide functionalities for processing KML/KMZ files, calculating polygon areas, generating HTML maps, and more.\n\n## Features\n\n1. **File Handling**\n    - Extract ZIP/KMZ files to access internal KML files.\n    - Convert KMZ files to KML format.\n\n2. **Geospatial Data Processing**\n    - Read KML files into GeoDataFrames for easy manipulation.\n    - Validate and classify coordinates (Decimal Degrees or UTM).\n    - Calculate polygon areas in hectares.\n\n3. **Visualization**\n    - Generate interactive HTML maps with Folium, including basemap overlays and polygon visualizations.\n\n4. **GeoJSON Handling**\n    - Add custom attributes to GeoJSON files and save updated outputs.\n\n5. **Utilities**\n    - Calculate string similarity for comparing names or identifiers.\n\n## Installation\n\nClone the repository and install the required dependencies:\n\n```bash\ngit clone https://github.com/hitthecodelabs/Geospatial-Data-Analysis.git\ncd GeographicalAnalysis\npip install -r requirements.txt\n```\n\n## Usage\n\n### 1. Extract ZIP/KMZ Files\n```python\nfrom geo_scripts import unzip_file\n\nunzip_file('path/to/your.zip', 'output/directory')\n```\n\nor\n\n```python\nfrom geo_scripts import unzip_file\n\nunzip_file('path/to/your.kmz', 'output/directory')\n```\n\n### 2. Convert KMZ to KML\n```python\nfrom geo_scripts import convert_kmz_to_kml\n\nkml_path = convert_kmz_to_kml('path/to/your.kmz')\n```\n\n### 3. Read KML into GeoDataFrame\n```python\nfrom geo_scripts import read_kml\n\ngdf, features = read_kml('path/to/your.kml')\n```\n\n### 4. Generate HTML Maps\n```python\nfrom geo_scripts import generate_html_map\n\ngenerate_html_map(gdf, 'output/maps', start_index=0, end_index=10)\n```\n\n### 5. Calculate Polygon Area\n```python\nfrom geo_scripts import calculate_polygon_area\n\nareas_gdf = calculate_polygon_area('path/to/your.kml')\n```\n\n### 6. Add Attribute to GeoJSON\n```python\nfrom geo_scripts import add_attribute_to_geojson\n\nadd_attribute_to_geojson('input.geojson', 'new_key', 'new_value', 'output.geojson')\n```\n\n## Requirements\n\n- Python 3.8+\n- Required libraries: `os`, `shutil`, `fiona`, `pyproj`, `zipfile`, `numpy`, `geopandas`, `folium`, `BeautifulSoup4`\n\nInstall the dependencies using:\n\n```bash\npip install -r requirements.txt\n```\n\n## Contributing\n\nFeel free to fork this repository and submit pull requests. Please ensure code follows PEP 8 standards and includes docstrings for all functions.\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n## Acknowledgments\n\nThis project uses open-source libraries and tools, including:\n\n- [Fiona](https://github.com/Toblerity/Fiona)\n- [GeoPandas](https://geopandas.org/)\n- [Folium](https://python-visualization.github.io/folium/)\n- [BeautifulSoup](https://www.crummy.com/software/BeautifulSoup/)\n\n## Contact\n\nFor questions or feedback, please reach out to the repository owner.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhitthecodelabs%2Fgeospatial-data-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhitthecodelabs%2Fgeospatial-data-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhitthecodelabs%2Fgeospatial-data-analysis/lists"}