Skip to content

decision-labs/geoai-sdk

Repository files navigation

๐ŸŒ GeoAI SDK

The AI-powered geospatial toolkit for JavaScript developers

npm version License: MIT Node.js TypeScript

Build intelligent geospatial applications with natural language queries

๐ŸŽฅ See It In Action

GeoAI SDK Demo

Watch the streaming AI agent in action - each step appears in real-time!

๐Ÿš€ What is GeoAI SDK?

GeoAI SDK is a powerful JavaScript library that combines AI agents with geospatial tools to create intelligent location-based applications. Ask questions in plain English and get structured geospatial data back!

// ๐Ÿค– Ask in natural language
const result = await agent.processNaturalLanguageQuery(
  "Find interesting places to visit in Berlin Mitte"
);

// ๐ŸŽฏ Get structured results
console.log(result.data.places); // 10+ landmarks with descriptions
console.log(result.data.location); // Geocoded coordinates
console.log(result.data.reasoning); // AI's step-by-step plan

โœจ Why Choose GeoAI SDK?

Feature GeoAI SDK Traditional GIS Libraries
Natural Language โœ… "Find restaurants near Times Square" โŒ Complex API calls
AI Planning โœ… Multi-step workflows โŒ Manual orchestration
Universal โœ… Node.js + Browser โŒ Server-only
TypeScript โœ… Full type safety โŒ Often untyped
Extensible โœ… Plugin architecture โŒ Monolithic

๐ŸŽฏ Perfect For

  • ๐Ÿ—บ๏ธ Location Intelligence Apps - Find POIs, analyze areas
  • ๐Ÿ›ฐ๏ธ Satellite Imagery Analysis - Search and process STAC data
  • ๐Ÿ›๏ธ Tourism & Travel - Discover landmarks and attractions
  • ๐Ÿ“Š Geospatial Analytics - Combine multiple data sources
  • ๐Ÿค– AI-Powered Maps - Natural language map interactions

๐Ÿš€ Quick Start

Installation

npm install geoai-sdk
# or
pnpm add geoai-sdk
# or  
yarn add geoai-sdk

30-Second Demo

import { GeoAgent } from 'geoai-sdk';

const agent = new GeoAgent({
  anthropicApiKey: 'your-api-key' // Get from https://console.anthropic.com/
});

// ๐ŸŽฏ One line to find places!
const result = await agent.processNaturalLanguageQuery(
  "Find landmarks around the Eiffel Tower"
);

console.log(`Found ${result.data.places.length} landmarks!`);
result.data.places.forEach(place => {
  console.log(`๐Ÿ“ ${place.name} (${place.distance}m away)`);
});

๐Ÿ›ฐ๏ธ STAC Satellite Imagery Search

// Search satellite imagery with natural language
const result = await agent.processNaturalLanguageQuery(
  'Find Sentinel-2 images of the Amazon rainforest from June 2023'
);

console.log(`Found ${result.data.stacResults.features.length} satellite images!`);
result.data.stacResults.features.forEach(image => {
  console.log(`๐Ÿ›ฐ๏ธ ${image.id} - ${image.properties.datetime}`);
});

๐Ÿ› ๏ธ Available Tools

๐Ÿ—บ๏ธ Geocoding Tool

Convert addresses โ†” coordinates using OpenStreetMap

const result = await agent.executeTool('geocoding', {
  operation: 'geocode',
  address: '1600 Pennsylvania Ave NW, Washington, DC'
});
// โ†’ { coordinates: { lat: 38.8977, lng: -77.0365 }, address: "White House..." }

๐Ÿ›ฐ๏ธ STAC Search Tool

Find satellite imagery and geospatial assets

const result = await agent.executeTool('stac_search', {
  bbox: { west: -122.5, south: 47.5, east: -122.4, north: 47.6 },
  datetime: '2023-06-01/2023-06-30',
  collections: ['sentinel-2-l2a']
});
// โ†’ Array of satellite images with metadata

๐Ÿ“– Wikipedia Geosearch Tool

Discover points of interest near any location

const result = await agent.executeTool('wikipedia_geosearch', {
  coordinates: { latitude: 52.52, longitude: 13.405 }, // Berlin
  radius: 1000,
  limit: 10
});
// โ†’ Array of Wikipedia articles about nearby landmarks

๐Ÿช POI Search Tool

Find points of interest using OpenStreetMap data

const result = await agent.executeTool('poi_search', {
  query: 'restaurants',
  location: { latitude: 52.52, longitude: 13.405 }, // Berlin
  radius: 1000,
  limit: 10
});
// โ†’ Array of restaurants with addresses and distances

๐Ÿ›ฃ๏ธ Routing Tool

Calculate optimal paths between locations

const result = await agent.executeTool('routing', {
  locations: [
    { latitude: 52.52, longitude: 13.405 }, // Berlin
    { latitude: 52.5185, longitude: 13.4081 } // Nearby point
  ],
  costing: 'auto',
  units: 'kilometers'
});
// โ†’ Route with distance, time, and turn-by-turn directions

โฑ๏ธ Isochrone Tool

Calculate accessible areas within time/distance limits

const result = await agent.executeTool('isochrone', {
  location: { latitude: 52.52, longitude: 13.405 }, // Berlin
  contours: [{ time: 10 }], // 10 minutes
  costing: 'pedestrian'
});
// โ†’ Geojson polygon showing accessible area

๐ŸŽจ Real-World Examples

๐Ÿ›๏ธ Tourism App

// "Show me museums near the Louvre in Paris"
const museums = await agent.processNaturalLanguageQuery(
  "Find museums near the Louvre in Paris"
);

๐Ÿ›ฐ๏ธ Satellite Analysis

// "Get recent satellite images of downtown Seattle"
const imagery = await agent.processNaturalLanguageQuery(
  "Find recent satellite imagery of downtown Seattle"
);

๐Ÿ• Local Discovery

// "Find pizza places near Central Park"
const restaurants = await agent.processNaturalLanguageQuery(
  "Find pizza restaurants near Central Park in New York"
);

๐ŸŒ Browser Usage

Works seamlessly in browsers with the UMD build:

<script src="https://unpkg.com/geoai-sdk/dist/umd/geoai-sdk.umd.js"></script>
<script>
  const agent = new GeoAI.GeoAgent({
    anthropicApiKey: 'your-api-key'
  });
  
  agent.processNaturalLanguageQuery("Find coffee shops in San Francisco")
    .then(result => console.log(result.data.places));
</script>

๐ŸŽฎ Interactive Demo

๐Ÿš€ Try It Yourself

# Start the demo server
cd examples/web
node backend.js

# Open http://localhost:3002 in your browser
# Ask questions like:
# - "Find landmarks around the Eiffel Tower"
# - "Show me interesting places in Berlin Mitte"

Features you'll see:

  • ๐Ÿค– Real-time AI reasoning - Watch the agent think through each step
  • ๐Ÿ“ Progressive geocoding - Location appears as it's found
  • ๐Ÿ›๏ธ Streaming place discovery - Places appear one by one on the map
  • ๐ŸŽจ Smooth animations - Each step has beautiful transitions

๐Ÿ“ Command Line Examples

# STAC satellite imagery search
node examples/stac-search-demo.js

# Simple STAC demo
node examples/simple-stac-demo.js

# Berlin Mitte places demo
node examples/berlin-mitte-demo.js

๐Ÿ—๏ธ Architecture

graph TD
    A[Natural Language Query] --> B[GeoAgent]
    B --> C[AI Planning]
    C --> D[Tool Selection]
    D --> E[Geocoding Tool]
    D --> F[STAC Tool] 
    D --> G[Wikipedia Tool]
    D --> H[POI Search Tool]
    D --> I[Routing Tool]
    D --> J[Isochrone Tool]
    E --> K[Shared Utilities]
    F --> K
    G --> K
    H --> K
    I --> K
    J --> K
    K --> L[Structured Results]
    L --> M[JSON Response]
Loading

๐Ÿ”ง Development

Prerequisites

  • Node.js 18+
  • pnpm (recommended)

Setup

git clone https://github.com/decision-labs/geoai-sdk.git
cd geoai-sdk
pnpm install

Testing

# Unit tests (mocked) - 102 tests
pnpm test:unit

# Live integration tests (real APIs) - 60 tests
pnpm test:live

# LLM integration tests (AI agent) - 5 tests
pnpm test:live:llm

# All tests (167 total)
pnpm test:all

Building

pnpm run build    # Build all formats
pnpm run lint     # Check code quality
pnpm run format   # Format code

๐Ÿ“š Documentation

๐Ÿ—บ๏ธ Roadmap

โœ… v0.1.0 - Foundation (Current)

  • Geocoding & Reverse Geocoding
  • STAC Search
  • Wikipedia Geosearch
  • AI Agent Integration
  • TypeScript Support
  • Browser Compatibility

๐Ÿšง v0.2.0 - Enhanced AI (Coming Soon)

  • Advanced Natural Language Processing
  • Multi-step Workflow Planning
  • Custom Tool Integration
  • Local Model Support

๐Ÿ”ฎ v0.3.0 - Advanced GIS

  • H3 Hexagonal Indexing
  • S2 Spherical Geometry
  • Spectral Indices (NDVI, NDWI)
  • Raster Processing

๐ŸŒŸ v0.4.0 - Enterprise

  • Geobase Integration
  • Supabase Real-time Features
  • Performance Optimizations
  • Enterprise Support

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Test thoroughly: pnpm test:all
  5. Commit with conventional commits: git commit -m "feat: add amazing feature"
  6. Push to your branch: git push origin feature/amazing-feature
  7. Open a Pull Request

Development Guidelines

  • Follow TDD principles
  • Maintain 90%+ test coverage
  • Use TypeScript strict mode
  • Follow conventional commits
  • Update documentation

๐Ÿ“Š Performance

Operation Time Notes
Geocoding ~200ms OpenStreetMap Nominatim
STAC Search ~500ms Element84 Earth Search
Wikipedia Search ~300ms Wikipedia API
AI Planning ~2-5s Anthropic Claude

๐Ÿ›ก๏ธ Security

  • โœ… No API keys stored in code
  • โœ… Environment variable configuration
  • โœ… Input validation and sanitization
  • โœ… Rate limiting compliance
  • โœ… HTTPS-only external calls

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ™ Acknowledgments

GeoAI SDK is built on top of amazing open-source services and APIs. We're grateful to the following organizations and communities:

๐ŸŒ Data & API Providers

๐Ÿค– AI & Technology

  • Anthropic - Claude AI for natural language processing and tool orchestration
  • Axios - HTTP client for API communications
  • Universal Geocoder - Geocoding abstraction library

๐Ÿ› ๏ธ Development Tools

๐Ÿ“š Standards & Protocols


๐Ÿ“ž Support


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published