-
Notifications
You must be signed in to change notification settings - Fork 11
hotfix: Add polygon map layers for 7 campaigns (Issue #207) #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "type": "FeatureCollection", | ||
| "name": "Campaign: Anavilhanas Archipelago Monitoring", | ||
| "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, | ||
| "features": [ | ||
| { | ||
| "type": "Feature", | ||
| "id": "anavilhanas-1", | ||
| "properties": { | ||
| "id": "anavilhanas-1", | ||
| "name": "Anavilhanas Archipelago Monitoring", | ||
| "campaign": "Anavilhanas Archipelago Monitoring", | ||
| "status": "active", | ||
| "partner": "ICMBio Brazil", | ||
| "acreage": 42000, | ||
| "watershed": "Rio Negro Archipelago", | ||
| "projectType": "Environmental Monitoring" | ||
| }, | ||
| "geometry": { | ||
| "type": "Polygon", | ||
| "coordinates": [ | ||
| [ | ||
| [-60.1800, -2.9600], | ||
| [-60.1200, -2.9400], | ||
| [-60.0800, -2.9700], | ||
| [-60.0900, -3.0000], | ||
| [-60.1400, -3.0100], | ||
| [-60.1800, -2.9900], | ||
| [-60.1800, -2.9600] | ||
| ] | ||
| ] | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| "type": "FeatureCollection", | ||
| "name": "Campaign: Ducke Forest Research", | ||
| "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, | ||
| "features": [ | ||
| { | ||
| "type": "Feature", | ||
| "id": "ducke-1", | ||
| "properties": { | ||
| "id": "ducke-1", | ||
| "name": "Ducke Forest Research", | ||
| "campaign": "Ducke Forest Research", | ||
| "status": "active", | ||
| "partner": "INPA Research Institute", | ||
| "acreage": 10000, | ||
| "watershed": "Upper Taruma Basin", | ||
| "projectType": "Research Station" | ||
| }, | ||
| "geometry": { | ||
| "type": "Polygon", | ||
| "coordinates": [ | ||
| [ | ||
| [-59.9700, -2.9500], | ||
| [-59.9200, -2.9500], | ||
| [-59.9200, -2.9900], | ||
| [-59.9400, -3.0100], | ||
| [-59.9700, -3.0000], | ||
| [-59.9700, -2.9500] | ||
| ] | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,35 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| "type": "FeatureCollection", | ||||||||||||||||||||||||||||||||||||||||||||||
| "name": "Campaign: Encontro das Aguas Reserve", | ||||||||||||||||||||||||||||||||||||||||||||||
| "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, | ||||||||||||||||||||||||||||||||||||||||||||||
| "features": [ | ||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||
| "type": "Feature", | ||||||||||||||||||||||||||||||||||||||||||||||
| "id": "encontro-1", | ||||||||||||||||||||||||||||||||||||||||||||||
| "properties": { | ||||||||||||||||||||||||||||||||||||||||||||||
| "id": "encontro-1", | ||||||||||||||||||||||||||||||||||||||||||||||
| "name": "Encontro das Aguas Reserve", | ||||||||||||||||||||||||||||||||||||||||||||||
| "campaign": "Encontro das Aguas Reserve", | ||||||||||||||||||||||||||||||||||||||||||||||
| "status": "active", | ||||||||||||||||||||||||||||||||||||||||||||||
| "partner": "Meeting of the Waters Foundation", | ||||||||||||||||||||||||||||||||||||||||||||||
| "acreage": 31000, | ||||||||||||||||||||||||||||||||||||||||||||||
| "watershed": "Negro-Solimoes Confluence", | ||||||||||||||||||||||||||||||||||||||||||||||
| "projectType": "Ecological Reserve" | ||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||
| "geometry": { | ||||||||||||||||||||||||||||||||||||||||||||||
| "type": "Polygon", | ||||||||||||||||||||||||||||||||||||||||||||||
| "coordinates": [ | ||||||||||||||||||||||||||||||||||||||||||||||
| [ | ||||||||||||||||||||||||||||||||||||||||||||||
| [-59.9800, -3.0800], | ||||||||||||||||||||||||||||||||||||||||||||||
| [-59.9200, -3.0800], | ||||||||||||||||||||||||||||||||||||||||||||||
| [-59.9000, -3.1100], | ||||||||||||||||||||||||||||||||||||||||||||||
| [-59.9200, -3.1400], | ||||||||||||||||||||||||||||||||||||||||||||||
| [-59.9600, -3.1400], | ||||||||||||||||||||||||||||||||||||||||||||||
| [-59.9800, -3.1200], | ||||||||||||||||||||||||||||||||||||||||||||||
| [-59.9800, -3.0800] | ||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+21
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All 7 exterior polygon rings are wound clockwise — violates RFC 7946 §3.1.6 RFC 7946 §3.1.6 mandates that "a linear ring MUST follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are counterclockwise, and holes are clockwise." Applying the shoelace signed-area formula to each fixture confirms every exterior ring has a negative signed area (clockwise). The violation is consistent across all seven files. For backwards compatibility, parsers SHOULD NOT reject polygons that do not follow the right-hand rule, so current Leaflet/Mapbox rendering will be unaffected. However, strict geospatial backends (PostGIS with The fix is simply to reverse the interior points of each ring while keeping the closing coordinate: 🔧 Proposed fix for `campaign_encontro_das_aguas.geojson` (apply same reversal pattern to all 7 files) "coordinates": [
[
- [-59.9800, -3.0800],
- [-59.9200, -3.0800],
- [-59.9000, -3.1100],
- [-59.9200, -3.1400],
- [-59.9600, -3.1400],
- [-59.9800, -3.1200],
- [-59.9800, -3.0800]
+ [-59.9800, -3.0800],
+ [-59.9800, -3.1200],
+ [-59.9600, -3.1400],
+ [-59.9200, -3.1400],
+ [-59.9000, -3.1100],
+ [-59.9200, -3.0800],
+ [-59.9800, -3.0800]
]
]You can automate rewinding all seven files at once using the 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Search for the FeatureProperties type/interface to confirm schema alignment
rg -n --type ts -A 20 "FeatureProperties"Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 2071 🏁 Script executed: #!/bin/bash
# Search for imports of the campaign fixture file
rg -n "campaign_encontro_das_aguas" --type tsRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 67 🏁 Script executed: #!/bin/bash
# Search for FeatureProperties interface (excluding QGIS)
rg -n "interface FeatureProperties|type FeatureProperties" --type ts -A 15Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 67 🏁 Script executed: #!/bin/bash
# Search for ProjectDetailView since it was mentioned as a consumer
rg -n "ProjectDetailView" --type ts -A 10 -B 5Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 67 🏁 Script executed: #!/bin/bash
# List the overall structure
ls -la src/Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 721 🏁 Script executed: #!/bin/bash
# Find all TypeScript files to understand project structure
fd -e ts -e tsx src/Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 407 🏁 Script executed: #!/bin/bash
# Search for "Feature" related type definitions
rg -n "interface.*Feature|type.*Feature" --type tsRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 1051 🏁 Script executed: #!/bin/bash
# Look for import.meta.glob patterns that might load fixtures
rg -n "import.meta.glob" --type tsRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 181 🏁 Script executed: #!/bin/bash
# Read the geometry types file
cat -n src/types/geometry.tsRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 432 🏁 Script executed: #!/bin/bash
# Read the fixture-reader.ts file
cat -n src/data/fixture-reader.tsRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 909 🏁 Script executed: #!/bin/bash
# Search for Feature type with properties in TypeScript files
rg -n "properties:" --type ts -B 3 -A 3 | head -60Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 700 🏁 Script executed: #!/bin/bash
# Search for components that use FixtureReader or access fixture data
rg -n "FixtureReader|fixture" --type ts -B 3 -A 3Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 2462 🏁 Script executed: #!/bin/bash
# Search for components that might access feature properties like "identifier" or "partners"
rg -n "\.properties\.|identifier|partners" --type tsx -B 2 -A 2Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 113 🏁 Script executed: #!/bin/bash
# Look at the components directory structure
find src/components -type f -name "*.tsx" -o -name "*.ts"Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 284 🏁 Script executed: #!/bin/bash
# Check Layer.tsx which likely iterates over features
cat -n src/components/Map/Layer.tsxRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 793 🏁 Script executed: #!/bin/bash
# Check MapContainer.tsx
cat -n src/components/Map/MapContainer.tsxRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 3684 🏁 Script executed: #!/bin/bash
# Search for any property access on feature objects
rg -n "feature\.properties|\.properties\[" --type tsRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 228 🏁 Script executed: #!/bin/bash
# Search for detail views or components that might show campaign info
rg -n "Detail|Campaign|campaign" --type ts --type tsx -iRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 113 🏁 Script executed: #!/bin/bash
# Check what the geojson types define for properties
rg -n "properties" --type ts src/hooks src/componentsRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 204 🏁 Script executed: #!/bin/bash
# Search for campaign or detail related files without tsx flag
find src -type f \( -name "*.ts" -o -name "*.tsx" \) | xargs grep -l "campaign\|Detail\|properties" -iRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 188 🏁 Script executed: #!/bin/bash
# Check if there's a types file for campaign or feature-specific properties
ls -la src/types/Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 313 🏁 Script executed: #!/bin/bash
# Search for all files that might define property-related interfaces
rg -n "interface.*Properties|type.*Properties" -uRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 150 🏁 Script executed: #!/bin/bash
# Check the map.ts file for property-related types
cat -n src/types/map.tsRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 3475 🏁 Script executed: #!/bin/bash
# Check if there are any recent commits that might show schema changes
git log --oneline -20 2>/dev/null | head -20Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 156 🏁 Script executed: #!/bin/bash
# Show the refactoring commit details
git show 56f21e4 --stat 2>/dev/nullRepository: OpenSourceFellows/map_dashboard_hackathon Length of output: 7156 🏁 Script executed: #!/bin/bash
# Show actual changes in that commit
git show 56f21e4 2>/dev/null | head -100Repository: OpenSourceFellows/map_dashboard_hackathon Length of output: 3115 Create The refactoring commit standardized campaign fixture properties ( 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| "type": "FeatureCollection", | ||
| "name": "Campaign: Puraquequara Lake Protection", | ||
| "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, | ||
| "features": [ | ||
| { | ||
| "type": "Feature", | ||
| "id": "puraquequara-1", | ||
| "properties": { | ||
| "id": "puraquequara-1", | ||
| "name": "Puraquequara Lake Protection", | ||
| "campaign": "Puraquequara Lake Protection", | ||
| "status": "planning", | ||
| "partner": "Manaus Environmental Agency", | ||
| "acreage": 7500, | ||
| "watershed": "Puraquequara Lake System", | ||
| "projectType": "Lake Protection" | ||
| }, | ||
| "geometry": { | ||
| "type": "Polygon", | ||
| "coordinates": [ | ||
| [ | ||
| [-59.9200, -3.0200], | ||
| [-59.8800, -3.0200], | ||
| [-59.8700, -3.0500], | ||
| [-59.8900, -3.0700], | ||
| [-59.9200, -3.0600], | ||
| [-59.9200, -3.0200] | ||
| ] | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| "type": "FeatureCollection", | ||
| "name": "Campaign: Rio Negro Conservation", | ||
| "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, | ||
| "features": [ | ||
| { | ||
| "type": "Feature", | ||
| "id": "rio-negro-1", | ||
| "properties": { | ||
| "id": "rio-negro-1", | ||
| "name": "Rio Negro Conservation", | ||
| "campaign": "Rio Negro Conservation", | ||
| "status": "active", | ||
| "partner": "Amazon River Foundation", | ||
| "acreage": 18500, | ||
| "watershed": "Rio Negro Basin", | ||
| "projectType": "River Conservation" | ||
| }, | ||
| "geometry": { | ||
| "type": "Polygon", | ||
| "coordinates": [ | ||
| [ | ||
| [-60.1200, -3.0500], | ||
| [-60.0600, -3.0500], | ||
| [-60.0600, -3.0900], | ||
| [-60.0800, -3.1100], | ||
| [-60.1200, -3.1100], | ||
| [-60.1200, -3.0500] | ||
| ] | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| "type": "FeatureCollection", | ||
| "name": "Campaign: Solimoes Wetland Restoration", | ||
| "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, | ||
| "features": [ | ||
| { | ||
| "type": "Feature", | ||
| "id": "solimoes-1", | ||
| "properties": { | ||
| "id": "solimoes-1", | ||
| "name": "Solimoes Wetland Restoration", | ||
| "campaign": "Solimoes Wetland Restoration", | ||
| "status": "active", | ||
| "partner": "Wetlands International", | ||
| "acreage": 22000, | ||
| "watershed": "Solimoes Watershed", | ||
| "projectType": "Wetland Restoration" | ||
| }, | ||
| "geometry": { | ||
| "type": "Polygon", | ||
| "coordinates": [ | ||
| [ | ||
| [-60.0800, -3.1400], | ||
| [-60.0200, -3.1400], | ||
| [-60.0200, -3.1800], | ||
| [-60.0500, -3.2000], | ||
| [-60.0800, -3.1900], | ||
| [-60.0800, -3.1400] | ||
| ] | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| "type": "FeatureCollection", | ||
| "name": "Campaign: Taruma Biodiversity Corridor", | ||
| "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, | ||
| "features": [ | ||
| { | ||
| "type": "Feature", | ||
| "id": "taruma-1", | ||
| "properties": { | ||
| "id": "taruma-1", | ||
| "name": "Taruma Biodiversity Corridor", | ||
| "campaign": "Taruma Biodiversity Corridor", | ||
| "status": "planning", | ||
| "partner": "Biodiversity Alliance Brazil", | ||
| "acreage": 9800, | ||
| "watershed": "Taruma-Acu Basin", | ||
| "projectType": "Wildlife Corridor" | ||
| }, | ||
| "geometry": { | ||
| "type": "Polygon", | ||
| "coordinates": [ | ||
| [ | ||
| [-60.1000, -3.0100], | ||
| [-60.0500, -3.0100], | ||
| [-60.0500, -3.0500], | ||
| [-60.0700, -3.0600], | ||
| [-60.1000, -3.0500], | ||
| [-60.1000, -3.0100] | ||
| ] | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ import { type JSX } from 'react' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { GeoJSON, Popup, Circle, Tooltip } from 'react-leaflet' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import type { FeatureCollection } from '@/types/geometry' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { type Point } from 'geojson' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { centroid } from '@turf/turf' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -29,8 +30,20 @@ export function Layer({ collection }: LayerProps): JSX.Element[] { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return collection.features | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .filter((feature): feature is NonNullable<typeof feature> => Boolean(feature)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .map((feature, idx) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const coordinates = (feature.geometry as Point).coordinates | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const geom = feature.geometry as any | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let coordinates: number[] = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (geom?.type === 'Point' && Array.isArray(geom.coordinates) && typeof geom.coordinates[0] === 'number') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| coordinates = geom.coordinates as number[] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const c = centroid(feature as any) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| coordinates = c?.geometry?.coordinates ?? [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+33
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove Lines 33 and 39 use explicit Suggested typed fix-import { type Point } from 'geojson'
+import type { Feature, Geometry, Point } from 'geojson'
- const geom = feature.geometry as any
+ const geom = feature.geometry as Geometry | null
...
- const c = centroid(feature as any)
+ const c = centroid(feature as Feature)🧰 Tools🪛 ESLint[error] 33-33: Unexpected any. Specify a different type. ( [error] 39-39: Unexpected any. Specify a different type. ( 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| coordinates = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const center = coordinates.length >= 2 ? [coordinates[1], coordinates[0]] as [number, number] : undefined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+35
to
47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Harden coordinate validation before building Current checks can accept partially invalid coordinate tuples (e.g., non-numeric Suggested guard- if (geom?.type === 'Point' && Array.isArray(geom.coordinates) && typeof geom.coordinates[0] === 'number') {
+ if (
+ geom?.type === 'Point' &&
+ Array.isArray(geom.coordinates) &&
+ Number.isFinite(geom.coordinates[0]) &&
+ Number.isFinite(geom.coordinates[1])
+ ) {
coordinates = geom.coordinates as number[]
} else {
...
- const center = coordinates.length >= 2 ? [coordinates[1], coordinates[0]] as [number, number] : undefined
+ const center =
+ coordinates.length >= 2 &&
+ Number.isFinite(coordinates[0]) &&
+ Number.isFinite(coordinates[1])
+ ? [coordinates[1], coordinates[0]] as [number, number]
+ : undefined📝 Committable suggestion
Suggested change
🧰 Tools🪛 ESLint[error] 39-39: Unexpected any. Specify a different type. ( 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <GeoJSON | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -39,17 +52,19 @@ export function Layer({ collection }: LayerProps): JSX.Element[] { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Tooltip permanent>{feature.properties?.identifier ?? ''}</Tooltip> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Popup is a clickable element. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {/* Popup is a clickable element. */} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Popup> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p>{feature.properties?.identifier ?? ''}</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p>Land Partner(s): {feature.properties?.partners.join(', ')}</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p>Current Acreage: {feature.properties?.measurement}</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p>Restoration Services: {feature.properties?.restorationServices.join(', ')}</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p>Land Partner(s): {(feature.properties?.partners ?? []).join(', ')}</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p>Current Acreage: {feature.properties?.measurement ?? ''}</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p>Restoration Services: {(feature.properties?.restorationServices ?? []).join(', ')}</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Popup> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Circle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| center={[coordinates[1], coordinates[0]]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| radius={Math.sqrt(feature.properties?.measurement * 4046.86)} // 1 acre = 4046.86 m^2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {center && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Circle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| center={center} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| radius={Math.sqrt((feature.properties?.measurement ?? 0) * 4046.86)} // 1 acre = 4046.86 m^2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+59
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use The component currently hardcodes acreage semantics ( Suggested contract-aligned update- <p>Current Acreage: {feature.properties?.measurement ?? ''}</p>
+ <p>
+ Measurement: {feature.properties?.measurement ?? ''} {feature.properties?.unitOfMeasure ?? ''}
+ </p>
- radius={Math.sqrt((feature.properties?.measurement ?? 0) * 4046.86)} // 1 acre = 4046.86 m^2
+ radius={Math.sqrt(
+ (feature.properties?.unitOfMeasure === 'acre'
+ ? (feature.properties?.measurement ?? 0) * 4046.86
+ : 0)
+ )}🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </GeoJSON> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: All fixture feature properties must match the Layer.tsx rendering contract.
Both reviewed fixtures (and likely all seven fixtures mentioned in the PR) use the old property schema instead of the unified schema described in PR objectives. Layer.tsx expects
identifier,partners(array),measurement,restorationServices(array) and will crash when calling.join()on undefined or string values.Apply the schema transformation to each fixture:
public/fixtures/campaign_anavilhanas_archipelago.geojson#L9-L18: Transform properties fromname/partner/acreage/watershedtoidentifier/partners[]/measurement+unitOfMeasure/watershedRegionand addrestorationServices: []public/fixtures/campaign_solimoes_wetland.geojson#L9-L18: Apply the same transformation (see diff in first per-site comment for exact structure)📍 Affects 2 files
public/fixtures/campaign_anavilhanas_archipelago.geojson#L9-L18(this comment)public/fixtures/campaign_solimoes_wetland.geojson#L9-L18🤖 Prompt for AI Agents