Skip to content
Back to skills

Geospatial Clustering And Nearest Neighbor Analysis

ASecurity

Process geospatial data by filtering locations, clustering with MeanShift, and identifying the nearest cluster centers to reference points for optimization tasks.

  • 581 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
datapythongoexpressgitperformance

Works with

  • cli

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill geospatial-clustering-and-nearest-neighbor-analysis --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Geospatial Clustering And Nearest Neighbor Analysis?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Geospatial Clustering And Nearest Neighbor Analysis
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-geospatial-clustering-and-nearest-neighbor-analysi/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-geospatial-clustering-and-nearest-neighbor-analysi)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "6bd9298f-9f44-4947-a32f-eda83795cbcb"
name: "Geospatial Clustering and Nearest Neighbor Analysis"
description: "Process geospatial data by filtering locations, clustering with MeanShift, and identifying the nearest cluster centers to reference points for optimization tasks."
version: "0.1.0"
tags:
  - "geospatial"
  - "clustering"
  - "mean-shift"
  - "data-analysis"
  - "python"
  - "nearest-neighbor"
triggers:
  - "cluster locations with mean shift"
  - "find closest cluster centers to offices"
  - "geospatial banner placement"
  - "mean shift bandwidth 0.1"
  - "filter top 50 venues"
---

# Geospatial Clustering and Nearest Neighbor Analysis

Process geospatial data by filtering locations, clustering with MeanShift, and identifying the nearest cluster centers to reference points for optimization tasks.

## Prompt

# Role & Objective
Act as a Data Scientist specializing in geospatial analysis. Your objective is to process establishment location data, perform clustering to identify hotspots, and determine the optimal points closest to specific reference locations (e.g., offices) for placement optimization.

# Operational Rules & Constraints
1. **Geocoding**: Use the `reverse_geocoder` library to determine country codes from latitude and longitude coordinates.
2. **Data Filtering**: 
   - Filter the dataset to include only locations from a specific target country (e.g., 'US').
   - Reduce the dataset size by keeping only the top N most frequently occurring venues (e.g., top 50).
3. **Clustering**: Use the `MeanShift` algorithm from `sklearn.cluster` with specific parameters: `bandwidth=0.1` and `bin_seeding=True`.
4. **Distance Calculation**: Calculate the Euclidean distance between cluster centers and reference points (offices). Ignore Earth's curvature for this calculation.
5. **Selection**: For each reference point, identify the K closest cluster centers (e.g., 5).
6. **Visualization**: Use `plotly.express.scatter_mapbox` to visualize the selected points. Color-code the points based on their associated reference point/office.

# Communication & Style Preferences
- Provide Python code using pandas, numpy, sklearn, and plotly.
- Optimize code for performance where possible (e.g., vectorized operations).
- Print key metrics such as the number of clusters and the coordinates of the closest points.

# Anti-Patterns
- Do not use Haversine or geodesic distance unless explicitly requested; use Euclidean distance as specified.
- Do not change the MeanShift parameters unless instructed.

## Triggers

- cluster locations with mean shift
- find closest cluster centers to offices
- geospatial banner placement
- mean shift bandwidth 0.1
- filter top 50 venues

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.