{"id":"geomaster","name":"geomaster","summary":"リモートセンシング、GIS、空間解析、地球観測のための機械学習、30+の科学分野を網羅した包括的な地理空間科学スキル。","body":"# GeoMaster\n\nComprehensive geospatial science skill covering GIS, remote sensing, spatial analysis, and ML for Earth observation across 70+ topics with 500+ code examples in 8 programming languages.\n\n## Installation\n\n```bash\n# Core Python stack (conda recommended)\nconda install -c conda-forge gdal rasterio fiona shapely pyproj geopandas\n\n# Remote sensing & ML\nuv pip install rsgislib torchgeo earthengine-api\nuv pip install scikit-learn xgboost torch-geometric\n\n# Network & visualization\nuv pip install osmnx networkx folium keplergl\nuv pip install cartopy contextily mapclassify\n\n# Big data & cloud\nuv pip install xarray rioxarray dask-geopandas\nuv pip install pystac-client planetary-computer\n\n# Point clouds\nuv pip install laspy pylas open3d pdal\n\n# Databases\nconda install -c conda-forge postgis spatialite\n```\n\n## Quick Start\n\n### NDVI from Sentinel-2\n\n```python\nimport rasterio\nimport numpy as np\n\nwith rasterio.open('sentinel2.tif') as src:\n    red = src.read(4).astype(float)   # B04\n    nir = src.read(8).astype(float)   # B08\n    ndvi = (nir - red) / (nir + red + 1e-8)\n    ndvi = np.nan_to_num(ndvi, nan=0)\n\n    profile = src.profile\n    profile.update(count=1, dtype=rasterio.float32)\n\n    with rasterio.open('ndvi.tif', 'w', **profile) as dst:\n        dst.write(ndvi.astype(rasterio.float32), 1)\n```\n\n### Spatial Analysis with GeoPandas\n\n```python\nimport geopandas as gpd\n\n# Load and ensure same CRS\nzones = gpd.read_file('zones.geojson')\npoints = gpd.read_file('points.geojson')\n\nif zones.crs != points.crs:\n    points = points.to_crs(zones.crs)\n\n# Spatial join and statistics\njoined = gpd.sjoin(points, zones, how='inner', predicate='within')\nstats = joined.groupby('zone_id').agg({\n    'value': ['count', 'mean', 'std', 'min', 'max']\n}).round(2)\n```\n\n### Google Earth Engine Time Series\n\n```python\nimport ee\nimport pandas as pd\n\nee.Initialize(project='your-project')\nroi = ee.Geometry.Point([-122.4, 37.7]).buffer(10000)\n\ns2 = (ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')\n      .filterBounds(roi)\n      .filterDate('2020-01-01', '2023-12-31')\n      .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20)))\n\ndef add_ndvi(img):\n    return img.addBands(img.normalizedDifference(['B8', 'B4']).rename('NDVI'))\n\ns2_ndvi = s2.map(add_ndvi)\n\ndef extract_series(image):\n    stats = image.reduceRegion(ee.Reducer.mean(), roi.centroid(), scale=10, maxPixels=1e9)\n    return ee.Feature(None, {'date': image.date().format('YYYY-MM-dd'), 'ndvi': stats.get('NDVI')})\n\nseries = s2_ndvi.map(extract_series).getInfo()\ndf = pd.DataFrame([f['properties'] for f in series['features']])\ndf['date'] = pd.to_datetime(df['date'])\n```\n\n## Core Concepts\n\n### Data Types\n\n| Type | Examples | Libraries |\n|------|----------|-----------|\n| Vector | Shapefile, GeoJSON, GeoPackage | GeoPandas, Fiona, GDAL |\n| Raster | GeoTIFF, NetCDF, COG | Rasterio, Xarray, GDAL |\n| Point Cloud | LAS, LAZ | Laspy, PDAL, Open3D |\n\n### Coordinate Systems\n\n- **EPSG:4326** (WGS 84) - Geographic, lat/lon, use for storage\n- **EPSG:3857** (Web Mercator) - Web maps only (don't use for area/distance!)\n- **EPSG:326xx/327xx** (UTM) - Metric calculations, <1% distortion per zone\n- Use `gdf.estimate_utm_crs()` for automatic UTM detection\n\n```python\n# Always check CRS before operations\nassert gdf1.crs == gdf2.crs, \"CRS mismatch!\"\n\n# For area/distance calculations, use projected CRS\ngdf_metric = gdf.to_crs(gdf.estimate_utm_crs())\narea_sqm = gdf_metric.geometry.area\n```\n\n### OGC Standards\n\n- **WMS**: Web Map Service - raster maps\n- **WFS**: Web Feature Service - vector data\n- **WCS**: Web Coverage Service - raster coverage\n- **STAC**: Spatiotemporal Asset Catalog - modern metadata\n\n## Common Operations\n\n### Spectral Indices\n\n```python\ndef calculate_indices(image_path):\n    \"\"\"NDVI, EVI, SAVI, NDWI from Sentinel-2.\"\"\"\n    with rasterio.open(image_path) as src:\n        B02, B03, B04, B08, B11 = [src.read(i).astype(float) for i in [1,2,3,4,5]]\n\n    ndvi = (B08 - B04) / (B08 + B04 + 1e-8)\n    evi = 2.5 * (B08 - B04) / (B08 + 6*B04 - 7.5*B02 + 1)\n    savi = ((B08 - B04) / (B08 + B04 + 0.5)) * 1.5\n    ndwi = (B03 - B08) / (B03 + B08 + 1e-8)\n\n    return {'NDVI': ndvi, 'EVI': evi, 'SAVI': savi, 'NDWI': ndwi}\n```\n\n### Vector Operations\n\n```python\n# Buffer (use projected CRS!)\ngdf_proj = gdf.to_crs(gdf.estimate_utm_crs())\ngdf['buffer_1km'] = gdf_proj.geometry.buffer(1000)\n\n# Spatial relationships\nintersects = gdf[gdf.geometry.intersects(other_geometry)]\ncontains = gdf[gdf.geometry.contains(point_geometry)]\n\n# Geometric operations\ngdf['centroid'] = gdf.geometry.centroid\ngdf['simplified'] = gdf.geometry.simplify(tolerance=0.001)\n\n# Overlay operations\nintersection = gpd.overlay(gdf1, gdf2, how='intersection')\nunion = gpd.overlay(gdf1, gdf2, how='union')\n```\n\n### Terrain Analysis\n\n```python\ndef terrain_metrics(dem_path):\n    \"\"\"Calculate slope, aspect, hillshade from DEM.\"\"\"\n    with rasterio.open(dem_path) as src:\n        dem = src.read(1)\n\n    dy, dx = np.gradient(dem)\n    slope = np.arctan(np.sqrt(dx**2 + dy**2)) * 180 / np.pi\n    aspect = (90 - np.arctan2(-dy, dx) * 180 / np.pi) % 360\n\n    # Hillshade\n    az_rad, alt_rad = np.radians(315), np.radians(45)\n    hillshade = (np.sin(alt_rad) * np.sin(np.radians(slope)) +\n                 np.cos(alt_rad) * np.cos(np.radians(slope)) *\n                 np.cos(np.radians(aspect) - az_rad))\n\n    return slope, aspect, hillshade\n```\n\n### Network Analysis\n\n```python\nimport osmnx as ox\nimport networkx as nx\n\n# Download and analyze street network\nG = ox.graph_from_place('San Francisco, CA', network_type='drive')\nG = ox.add_edge_speeds(G).add_edge_travel_times(G)\n\n# Shortest path\norig = ox.distance.nearest_nodes(G, -122.4, 37.7)\ndest = ox.distance.nearest_nodes(G, -122.3, 37.8)\nroute = nx.shortest_path(G, orig, dest, weight='travel_time')\n```\n\n## Image Classification\n\n```python\nfrom sklearn.ensemble import RandomForestClassifier\nimport rasterio\nfrom rasterio.features import rasterize\n\ndef classify_imagery(raster_path, training_gdf, output_path):\n    \"\"\"Train RF and classify imagery.\"\"\"\n    with rasterio.open(raster_path) as src:\n        image = src.read()\n        profile = src.profile\n        transform = src.transform\n\n    # Extract training data\n    X_train, y_train = [], []\n    for _, row in training_gdf.iterrows():\n        mask = rasterize([(row.geometry, 1)],\n                        out_shape=(profile['height'], profile['width']),\n                        transform=transform, fill=0, dtype=np.uint8)\n        pixels = image[:, mask > 0].T\n        X_train.extend(pixels)\n        y_train.extend([row['class_id']] * len(pixels))\n\n    # Train and predict\n    rf = RandomForestClassifier(n_estimators=100, max_depth=20, n_jobs=-1)\n    rf.fit(X_train, y_train)\n\n    prediction = rf.predict(image.reshape(image.shape[0], -1).T)\n    prediction = prediction.reshape(profile['height'], profile['width'])\n\n    profile.update(dtype=rasterio.uint8, count=1)\n    with rasterio.open(output_path, 'w', **profile) as dst:\n        dst.write(prediction.astype(rasterio.uint8), 1)\n\n    return rf\n```\n\n## Modern Cloud-Native Workflows\n\n### STAC + Planetary Computer\n\n```python\nimport pystac_client\nimport planetary_computer\nimport odc.stac\n\n# Search Sentinel-2 via STAC\ncatalog = pystac_client.Client.open(\n    \"https://planetarycomputer.microsoft.com/api/stac/v1\",\n    modifier=planetary_computer.sign_inplace,\n)\n\nsearch = catalog.search(\n    collections=[\"sentinel-2-l2a\"],\n    bbox=[-122.5, 37.7, -122.3, 37.9],\n    datetime=\"2023-01-01/2023-12-31\",\n    query={\"eo:cloud_cover\": {\"lt\": 20}},\n)\n\n# Load as xarray (cloud-native!)\ndata = odc.stac.load(\n    list(search.get_items())[:5],\n    bands=[\"B02\", \"B03\", \"B04\", \"B08\"],\n    crs=\"EPSG:32610\",\n    resolution=10,\n)\n\n# Calculate NDVI on xarray\nndvi = (data.B08 - data.B04) / (data.B08 + data.B04)\n```\n\n### Cloud-Optimized GeoTIFF (COG)\n\n```python\nimport rasterio\nfrom rasterio.session import AWSSession\n\n# Read COG directly from cloud (partial reads)\nsession = AWSSession(aws_access_key_id=..., aws_secret_access_key=...)\nwith rasterio.open('s3://bucket/path.tif', session=session) as src:\n    # Read only window of interest\n    window = ((1000, 2000), (1000, 2000))\n    subset = src.read(1, window=window)\n\n# Write COG\nwith rasterio.open('output.tif', 'w', **profile,\n                   tiled=True, blockxsize=256, blockysize=256,\n                   compress='DEFLATE', predictor=2) as dst:\n    dst.write(data)\n\n# Validate COG\nfrom rio_cogeo.cogeo import cog_validate\ncog_validate('output.tif')\n```\n\n## Performance Tips\n\n```python\n# 1. Spatial indexing (10-100x faster queries)\ngdf.sindex  # Auto-created by GeoPandas\n\n# 2. Chunk large rasters\nwith rasterio.open('large.tif') as src:\n    for i, window in src.block_windows(1):\n        block = src.read(1, window=window)\n\n# 3. Dask for big data\nimport dask.array as da\ndask_array = da.from_rasterio('large.tif', chunks=(1, 1024, 1024))\n\n# 4. Use Arrow for I/O\ngdf.to_file('output.gpkg', use_arrow=True)\n\n# 5. GDAL caching\nfrom osgeo import gdal\ngdal.SetCacheMax(2**30)  # 1GB cache\n\n# 6. Parallel processing\nrf = RandomForestClassifier(n_jobs=-1)  # All cores\n```\n\n## Best Practices\n\n1. **Always check CRS** before spatial operations\n2. **Use projected CRS** for area/distance calculations\n3. **Validate geometries**: `gdf = gdf[gdf.is_valid]`\n4. **Handle missing data**: `gdf['geometry'] = gdf['geometry'].fillna(None)`\n5. **Use efficient formats**: GeoPackage > Shapefile, Parquet for large data\n6. **Apply cloud masking** to optical imagery\n7. **Preserve lineage** for reproducible research\n8. **Use appropriate resolution** for your analysis scale\n\n## Detailed Documentation\n\n- **[Coordinate Systems](references/coordinate-systems.md)** - CRS fundamentals, UTM, transformations\n- **[Core Libraries](references/core-libraries.md)** - GDAL, Rasterio, GeoPandas, Shapely\n- **[Remote Sensing](references/remote-sensing.md)** - Satellite missions, spectral indices, SAR\n- **[Machine Learning](references/machine-learning.md)** - Deep learning, CNNs, GNNs for RS\n- **[GIS Software](references/gis-software.md)** - QGIS, ArcGIS, GRASS integration\n- **[Scientific Domains](references/scientific-domains.md)** - Marine, hydrology, agriculture, forestry\n- **[Advanced GIS](references/advanced-gis.md)** - 3D GIS, spatiotemporal, topology\n- **[Big Data](references/big-data.md)** - Distributed processing, GPU acceleration\n- **[Industry Applications](references/industry-applications.md)** - Urban planning, disaster management\n- **[Programming Languages](references/programming-languages.md)** - Python, R, Julia, JS, C++, Java, Go, Rust\n- **[Data Sources](references/data-sources.md)** - Satellite catalogs, APIs\n- **[Troubleshooting](references/troubleshooting.md)** - Common issues, debugging, error reference\n- **[Code Examples](references/code-examples.md)** - 500+ examples\n\n---\n\n**GeoMaster covers everything from basic GIS operations to advanced remote sensing and machine learning.**","author":"@K-Dense-AI","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills/geomaster","license":"MIT","category":"writing","lang":"en","tokens":3166,"stars":0,"calls30d":0,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[{"path":"README.md","size":3326,"sha256":"2bc301cf76562cc037eeec08663ff83736ce562860cd0ffb588d6fcaa8f79199"},{"path":"references/advanced-gis.md","size":11121,"sha256":"03e7562a192842c805a90e773e09d58c39fc5550af2d1c2da7c0e23a2667c1c6"},{"path":"references/big-data.md","size":8818,"sha256":"4b419a32926a1012283301f42a6c1bdd52368dc3bfe361ddc9e96835335be53d"},{"path":"references/code-examples.md","size":13023,"sha256":"4e27a32f0e58fe26d2e05725a634eb4440d94326d0986c94e1912a1bb1c679f7"},{"path":"references/coordinate-systems.md","size":8893,"sha256":"a5a3ec7310167c1b53a1e2c10a27abfb3e435d4b9a8aeb30fe50e99d0489a69d"},{"path":"references/core-libraries.md","size":6866,"sha256":"ea3e539ffe4761cfd42349e4904b648098035737c200bc431bdad7291b9450e7"},{"path":"references/data-sources.md","size":9331,"sha256":"ef471317a305f436e17c45a29d8da1bbed364a210154512f4f7f8b76c1126eec"},{"path":"references/gis-software.md","size":9284,"sha256":"35ca5e7bda17a30187ee197bd6ae0c40d902c10b59e261ae15cc6eda35c93b6a"},{"path":"references/industry-applications.md","size":13491,"sha256":"d33a9e02557a97c877c1be8fd66321ed7041a81087c506818491d6c09c98938f"},{"path":"references/machine-learning.md","size":13245,"sha256":"26150dc12bde1174f183d58950e6318038713cbd2d9315980922be4d40a8c29d"},{"path":"references/programming-languages.md","size":11417,"sha256":"bc46b96228bc53cfddb7c1c2090c08d0de84b0456e5b3dd645f59126ddf011a5"},{"path":"references/remote-sensing.md","size":10474,"sha256":"b192fcd635c1456d4ee8265b327943f5036628ae3dc7395921b0cda5db116fe6"},{"path":"references/scientific-domains.md","size":11027,"sha256":"1f513dc59bbac542dd8c116eb54182fdaa8fc691b53939a99ad9ba200f061184"},{"path":"references/specialized-topics.md","size":11114,"sha256":"c8ee2cb396814a7462ac52228a705b2770d80698d78d123ea778b6d42e32b742"},{"path":"references/troubleshooting.md","size":11231,"sha256":"7be40a157317e04671eb3e802703c0d1fd8d8dcc69f8249d3aab743a5c63e9eb"}],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[{"code":"code.eval","kind":"dangerous-code","where":"references/machine-learning.md:208","excerpt":"eval(","message":"evaluates code at runtime","severity":"warn"}],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":["api.mapbox.com","api.openweathermap.org","asterweb.jpl.nasa.gov","cds.climate.copernicus.eu","copernicus.eu","data.humdata.org","datasets.wri.org","earth-search.aws.element84.com","earthexplorer.usgs.gov","epsg.org","gadm.org","geopandas.org","gis.stackexchange.com","gis.wheelwrights.com","gmao.gsfc.nasa.gov","jra.kishou.go.jp","land.copernicus.eu","lpdaac.usgs.gov","maps.googleapis.com","naturalearth.s3.amazonaws.com","overpass-api.de","planetarycomputer.microsoft.com","proj.org","pyproj4.github.io","rasterio.readthedocs.io","scihub.copernicus.eu","sedac.ciesin.columbia.edu","worldcover2021.esa.int","www.eorc.jaxa.jp","www.esri.com","www.hydrosheds.org","www.mrlc.gov","www.pgc.umn.edu","www.usgs.gov","www.worldpop.org"]}}