Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

## Bug Report

**Version:**
geoai.js v1.0.x

**Describe the bug**
**Describe the bug**

<!-- Clear and concise description -->

**Steps to Reproduce**
1. …
2. …
**Steps to Reproduce**

1. …
2. …

**Expected behavior**

**Expected behavior**
<!-- What you thought would happen -->

**Actual behavior**
**Actual behavior**

<!-- What actually happened -->

**Environment**
- Browser/OS:
- GPU (if WebGPU):
- Node/Tooling (if applicable):
**Environment**

- Browser/OS:
- GPU (if WebGPU):
- Node/Tooling (if applicable):

**Logs / Screenshots**

**Logs / Screenshots**
<!-- Paste console logs or screenshots -->

**Additional context**
**Additional context**

<!-- Anything else helpful -->
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx lint-staged
npx lint-staged
10 changes: 9 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,19 @@ pnpm format:scripts
## Architecture Patterns

### AI Model Implementation

- Each model in `src/models/` follows the same interface pattern
- Models export a default function with typed inputs/outputs
- Use the registry pattern in `src/registry.ts` for model registration

### Provider Integration

- All map providers implement the same interface in `src/data_providers/`
- Handle different authentication methods (API keys, tokens, none)
- Support raster data sources only for now

### React Hook Pattern

- Use consistent state management (loading, error, result)
- Implement proper cleanup for large data structures
- Support web worker execution for performance
Expand All @@ -64,11 +67,13 @@ pnpm format:scripts
## Development Environment

### Dependencies

- **Peer dependencies** are required: `@huggingface/transformers`, `onnxruntime-web`
- **Node.js 18+** required for development
- **pnpm** as package manager (not npm or yarn)

### Build Process

- **Vite** for bundling with custom configuration
- **TypeScript** definitions generated separately
- **Single bundle output** for CDN usage
Expand All @@ -77,7 +82,7 @@ pnpm format:scripts
## Performance Considerations

- **Memory management** is critical - AI models use significant RAM
- **Web workers** should be used for inference to prevent UI blocking
- **Web workers** should be used for inference to prevent UI blocking
- **Lazy loading** of models when possible
- **Proper cleanup** of resources, especially in React hooks

Expand All @@ -99,19 +104,22 @@ pnpm format:scripts
## Common Tasks

### Adding a New AI Model

1. Create model implementation in `src/models/`
2. Add to registry in `src/registry.ts`
3. Define TypeScript types in `src/core/types.ts`
4. Add comprehensive tests
5. Update documentation

### Adding a Map Provider

1. Implement provider interface in `src/data_providers/`
2. Handle authentication and rate limiting
3. Test with various coordinate systems
4. Add integration tests

### React Hook Updates

1. Follow existing state management patterns
2. Implement proper TypeScript generics
3. Test with different AI model combinations
Expand Down
22 changes: 18 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Changed

- Removed OpenCV.js dependency across all AI models for improved performance and reduced bundle size
- Migrated building-footprint-segmentation and landcover-classification to use d3-contours for contour processing
- Replaced OpenCV implementations with native JavaScript solutions

### Added

- Tile stitching method to GeoRawImage for improved image handling capabilities
- GeoJSON output option for landcover classification results
- Result layer type selector for better visualization control
- Graceful error handling for tile image loading failures
- TMS provider now supports both WebMercator (XYZ) and traditional TMS tile schemes

### Fixed

- Mask generation post-processing improvements
- Multipolygon issues in mask generation
- Landcover classification mask to polygon conversion accuracy
- Image loading now continues when some tiles fail instead of throwing error immediately
- Added proper error type `ImageLoadFailed` for when all tiles fail to load
- TMS provider tile coordinate calculation for Cesium compatibility

### Improved

- Overall library performance with removal of heavy OpenCV dependency
- Memory usage optimization in geospatial processing tasks

## [1.0.0-rc.1] - 2024-01-XX

### Release Candidate

This is the first release candidate for version 1.0.0. This RC includes all the features and improvements planned for the final 1.0.0 release.

## [1.0.0-rc.2] - 2025-01-XX

### Release Candidate

- Bug fixes and improvements
- Minor documentation updates and example references to the new RC version.
- Internal release scripts updated to support rc.2 flow.
Expand All @@ -42,14 +53,17 @@ This is the first release candidate for version 1.0.0. This RC includes all the
## [1.0.0] - 2024-01-XX

### Changed

- **BREAKING**: Renamed package from `geoai-js` to `geoai`
- Updated all import statements and package references
- Updated build output structure from `geoai-js.js` to `geoai.js`
- Updated documentation and examples
- Updated repository URLs and homepage

### Migration Guide

To migrate from the old package:

1. Update your package.json: `"geoai-js": "^0.0.7"` → `"geoai": "^1.0.0"`
2. Update all import statements: `import { geoai } from "geoai"` → `import { geoai } from "geoai"`
3. Update any build configurations that reference the old package name
Expand Down Expand Up @@ -114,23 +128,23 @@ To migrate from the old package:
## [1.0.0-rc.3] - 2025-08-21

### Release Candidate
- Fix: remove hardcoded modelParams from the image-feature-extraction task

- Fix: remove hardcoded modelParams from the image-feature-extraction task

## [1.0.0-rc.4] - 2025-08-22

### Release Candidate
- Update docs. Minor bug fixes.

- Update docs. Minor bug fixes.

## [1.0.1] - 2025-08-28

### Release Candidate
- Removed OpenCV.js dependency across all AI models for improved performance and reduced bundle size.

- Removed OpenCV.js dependency across all AI models for improved performance and reduced bundle size.

## [1.0.3] - 2025-08-28

### Release Candidate
- Landuse classification vectorisation bug fix

- Landuse classification vectorisation bug fix
13 changes: 11 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,47 @@ GeoAI.js is a TypeScript library for running specialized geospatial AI models in
## Development Commands

**Primary workflow:**

- `pnpm dev` - Start development server
- `pnpm build` - Full build (core + types + package)
- `pnpm build` - Full build (core + types + package)
- `pnpm test` - Run test suite with Vitest
- `pnpm test:coverage` - Run tests with coverage report

**Quality checks:**

- `pnpm lint:scripts` - Lint TypeScript files with ESLint
- `pnpm format:scripts` - Format code with Prettier
- `pnpm test:build` - Test the built package works correctly

**Individual build steps:**

- `pnpm build:core` - TypeScript compilation + Vite build
- `pnpm build:types` - Generate TypeScript definitions
- `pnpm build:types` - Generate TypeScript definitions
- `pnpm build:package` - Copy package.json to build directory

## Architecture

### Core Pipeline System

The main architecture revolves around a pipeline that can chain multiple AI tasks:

- **Pipeline validation**: Checks task dependencies and parameter compatibility
- **Model registry**: Centralized registry of all the AI models in `src/registry.ts`
- **Provider abstraction**: Multiple map data providers through `src/data_providers/`
- **Type safety**: Strong TypeScript typing throughout with core types in `src/core/types.ts`

### Key Files

- `src/geoai.ts` - Main pipeline implementation and public API
- `src/registry.ts` - Model registry with all the AI task definitions
- `src/models/` - Individual AI model implementations
- `src/data_providers/` - Map provider integrations (ESRI, Geobase, etc.)
- `src/types/` - Core data types like GeoRawImage, BoundingBox

### React Integration

React hooks are implemented with sophisticated lifecycle management:

- `useGeoAIWorker` - Advanced hook with full state management
- `useOptimizedGeoAI` - Helper hook with optimized parameters
- Web worker support for non-blocking AI inference
Expand All @@ -62,6 +70,7 @@ React hooks are implemented with sophisticated lifecycle management:
## AI Tasks Architecture

All the AI tasks fall into categories:

- **Detection**: Object detection, zero-shot detection, oriented detection
- **Segmentation**: Mask generation, building footprints, wetlands
- **Classification**: Land cover classification
Expand Down
39 changes: 16 additions & 23 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Contributor Covenant 3.0 Code of Conduct

## Our Pledge
Expand All @@ -7,7 +6,6 @@ We pledge to make our community welcoming, safe, and equitable for all.

We are committed to fostering an environment that respects and promotes the dignity, rights, and contributions of all individuals, regardless of characteristics including race, ethnicity, caste, color, age, physical characteristics, neurodiversity, disability, sex or gender, gender identity or expression, sexual orientation, language, philosophy or religion, national or social origin, socio-economic position, level of education, or other status. The same privileges of participation are extended to everyone who participates in good faith and in accordance with this Covenant.


## Encouraged Behaviors

While acknowledging differences in social norms, we all strive to meet our community's expectations for positive behavior. We also understand that our words and actions may be interpreted differently than we intend based on culture, background, or native language.
Expand All @@ -22,7 +20,6 @@ With these considerations in mind, we agree to behave mindfully toward each othe
6. Committing to **repairing harm** when it occurs.
7. Behaving in other ways that promote and sustain the **well-being of our community**.


## Restricted Behaviors

We agree to restrict the following behaviors in our community. Instances, threats, and promotion of these behaviors are violations of this Code of Conduct.
Expand All @@ -42,7 +39,6 @@ We agree to restrict the following behaviors in our community. Instances, threat
3. **Promotional materials**. Sharing marketing or other commercial content in a way that is outside the norms of the community.
4. **Irresponsible communication.** Failing to responsibly present content which includes, links or describes any other restricted behaviors.


## Reporting an Issue

Tensions can occur between community members even when they are trying their best to collaborate. Not every conflict represents a code of conduct violation, and this Code of Conduct reinforces encouraged behaviors and norms that can help avoid conflicts and minimize harm.
Expand All @@ -51,36 +47,33 @@ When an incident does occur, it is important to report it promptly. To report a

Community Moderators take reports of violations seriously and will make every effort to respond in a timely manner. They will investigate all reports of code of conduct violations, reviewing messages, logs, and recordings, or interviewing witnesses and other participants. Community Moderators will keep investigation and enforcement actions as transparent as possible while prioritizing safety and confidentiality. In order to honor these values, enforcement actions are carried out in private with the involved parties, but communicating to the whole community may be part of a mutually agreed upon resolution.


## Addressing and Repairing Harm

If an investigation by the Community Moderators finds that this Code of Conduct has been violated, the following enforcement ladder may be used to determine how best to repair harm, based on the incident's impact on the individuals involved and the community as a whole. Depending on the severity of a violation, lower rungs on the ladder may be skipped.

1) Warning
1) Event: A violation involving a single incident or series of incidents.
2) Consequence: A private, written warning from the Community Moderators.
3) Repair: Examples of repair include a private written apology, acknowledgement of responsibility, and seeking clarification on expectations.
2) Temporarily Limited Activities
1) Event: A repeated incidence of a violation that previously resulted in a warning, or the first incidence of a more serious violation.
2) Consequence: A private, written warning with a time-limited cooldown period designed to underscore the seriousness of the situation and give the community members involved time to process the incident. The cooldown period may be limited to particular communication channels or interactions with particular community members.
3) Repair: Examples of repair may include making an apology, using the cooldown period to reflect on actions and impact, and being thoughtful about re-entering community spaces after the period is over.
3) Temporary Suspension
1) Event: A pattern of repeated violation which the Community Moderators have tried to address with warnings, or a single serious violation.
2) Consequence: A private written warning with conditions for return from suspension. In general, temporary suspensions give the person being suspended time to reflect upon their behavior and possible corrective actions.
3) Repair: Examples of repair include respecting the spirit of the suspension, meeting the specified conditions for return, and being thoughtful about how to reintegrate with the community when the suspension is lifted.
4) Permanent Ban
1) Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or a violation so serious that the Community Moderators determine there is no way to keep the community safe with this person as a member.
2) Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working through other remedies has failed to change the behavior.
3) Repair: There is no possible repair in cases of this severity.
1. Warning
1. Event: A violation involving a single incident or series of incidents.
2. Consequence: A private, written warning from the Community Moderators.
3. Repair: Examples of repair include a private written apology, acknowledgement of responsibility, and seeking clarification on expectations.
2. Temporarily Limited Activities
1. Event: A repeated incidence of a violation that previously resulted in a warning, or the first incidence of a more serious violation.
2. Consequence: A private, written warning with a time-limited cooldown period designed to underscore the seriousness of the situation and give the community members involved time to process the incident. The cooldown period may be limited to particular communication channels or interactions with particular community members.
3. Repair: Examples of repair may include making an apology, using the cooldown period to reflect on actions and impact, and being thoughtful about re-entering community spaces after the period is over.
3. Temporary Suspension
1. Event: A pattern of repeated violation which the Community Moderators have tried to address with warnings, or a single serious violation.
2. Consequence: A private written warning with conditions for return from suspension. In general, temporary suspensions give the person being suspended time to reflect upon their behavior and possible corrective actions.
3. Repair: Examples of repair include respecting the spirit of the suspension, meeting the specified conditions for return, and being thoughtful about how to reintegrate with the community when the suspension is lifted.
4. Permanent Ban
1. Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or a violation so serious that the Community Moderators determine there is no way to keep the community safe with this person as a member.
2. Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working through other remedies has failed to change the behavior.
3. Repair: There is no possible repair in cases of this severity.

This enforcement ladder is intended as a guideline. It does not limit the ability of Community Managers to use their discretion and judgment, in keeping with the best interests of our community.


## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public or other spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.


## Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 3.0, permanently available at [https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/).
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ We follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0
```

Common types include:

- `feat`: A new feature
- `fix`: A bug fix
- `docs`: Documentation changes
Expand Down Expand Up @@ -118,4 +119,4 @@ Improvements to documentation are always welcome. Our documentation is written i

## License

By contributing to GeoAI.js, you agree that your contributions will be licensed under the MIT License.
By contributing to GeoAI.js, you agree that your contributions will be licensed under the MIT License.
Loading