I understand you're asking about making the resolution search visualizations more contextual to user needs and queries. Currently, the resolution search captures map images and displays them in a carousel, but the response doesn't clearly indicate what the analysis is focusing on or how it relates to the user's specific context. 1 2
Current State
The resolution search system captures map images (Mapbox and/or Google) and analyzes them with the resolutionSearch agent, which includes context like:
- User-drawn features on the map 3
- Geographic coordinates and location name 4
- Recent news for the location 5
- Temporal context (local time) 6
However, the visualizations displayed in the ResolutionCarousel use generic labels like "Mapbox Capture" or "Google Capture" without explicitly referencing what the analysis is focusing on. 7
Making Visualizations More Contextual
To address this, you could enhance the system prompt in resolutionSearch to make the summary more explicitly contextual about what it's analyzing:
// In lib/agents/resolution-search.tsx, enhance the system prompt to include:
${drawnFeatures && drawnFeatures.length > 0 ? `**User-Drawn Features:**
The user has drawn the following features on the map for your reference:
${drawnFeatures.map(f => `- ${f.type} (${f.measurement}): ${JSON.stringify(f.geometry)}`).join('\n')}
Use these user-drawn areas/lines as primary areas of interest for your analysis.
IMPORTANT: In your summary, explicitly state what features you are analyzing and why.` : ''}
Additionally, you could modify the ResolutionCarousel to accept context-aware labels based on the analysis results, rather than static labels. 1
The response schema already supports contextual information through the summary field which should include land feature classification, points of interest, and relevant context. 8
Notes
The current implementation does include contextual information in the analysis (drawn features, location, news, time), but the visual presentation in the carousel doesn't explicitly surface this context to users. The enhancement would focus on making the summary text more explicit about what is being analyzed and potentially updating the carousel labels to reflect the analysis focus.
Wiki pages you might want to explore:
Citations
File: components/resolution-carousel.tsx (L110-151)
return (
<div className="w-full max-w-lg mx-auto my-4 px-2">
<Carousel className="w-full">
<CarouselContent>
{slides.map((slide, index) => (
<CarouselItem key={index}>
<div className="flex flex-col items-center p-1">
{slide.type === 'compare' ? (
<CompareSlider leftImage={slide.left} rightImage={slide.right} className="w-full" />
) : (
<>
<ResolutionImage src={slide.src} className="mb-0 mt-0 w-full" />
{slide.showAnalysis && (
<Button
variant="default"
size="sm"
className="mt-2 w-full font-bold py-4 h-auto text-xs uppercase tracking-widest"
onClick={handleQCXAnalysis}
disabled={isAnalyzing}
>
{isAnalyzing ? 'ANALYZING...' : 'QCX-TERRA ANALYSIS'}
</Button>
)}
<div className="mt-1 text-[10px] text-muted-foreground uppercase tracking-widest">
{slide.label}
</div>
</>
)}
</div>
</CarouselItem>
))}
</CarouselContent>
{slides.length > 1 && (
<div className="flex justify-center gap-4 mt-2">
<CarouselPrevious className="static translate-y-0" />
<CarouselNext className="static translate-y-0" />
</div>
)}
</Carousel>
</div>
)
}
File: lib/agents/resolution-search.tsx (L101-135)
const systemPrompt = `
As a geospatial analyst, your task is to analyze the provided satellite image of a geographic location.
**Temporal Context:**
The current local time at this location is ${localTime} (timezone: ${timezone}).
This temporal information is important for understanding the current state and any time-sensitive features visible in the image.
${location ? `**Geographic Coordinates:**
The coordinates provided for this image are: Latitude ${location.lat}, Longitude ${location.lng}.
Location: ${locationName}` : ''}
${newsContext ? `**Recent Context:**
${newsContext}
Please incorporate this recent news context into your analysis where relevant.` : ''}
${drawnFeatures && drawnFeatures.length > 0 ? `**User-Drawn Features:**
The user has drawn the following features on the map for your reference:
${drawnFeatures.map(f => `- ${f.type} (${f.measurement}): ${JSON.stringify(f.geometry)}`).join('\n')}
Use these user-drawn areas/lines as primary areas of interest for your analysis.` : ''}
**Analysis Requirements:**
1. **Land Feature Classification:** Identify and describe the different types of land cover visible in the image (e.g., urban areas, forests, water bodies, agricultural fields).
2. **Points of Interest (POI):** Detect and name any significant landmarks, infrastructure (e.g., bridges, major roads), or notable buildings.
3. **Temporal Analysis:** Consider how the time of day and season might affect what's visible in the image.
4. **Coordinate Extraction:** If possible, confirm or refine the geocoordinates (latitude/longitude) of the center of the image.
5. **COG Applicability:** Determine if this location would benefit from Cloud Optimized GeoTIFF (COG) analysis for high-precision temporal or spectral data.
6. **News Integration:** Reference any recent news or events that may be relevant to the current state of the location.
7. **Structured Output:** Return your findings in a structured JSON format including summary, geoJson (if any), news context, and any extracted coordinates or COG information. Use the provided schema.
Your analysis should be based on the visual information in the image, the temporal context provided, and your general knowledge. Do not attempt to access external websites or perform web searches beyond what has been provided.
Analyze the user's prompt and the image to provide a holistic understanding of the location with full temporal and contextual awareness.
`;
File: lib/schema/resolution-search.ts (L8-10)
export const resolutionSearchSchema = z.object({
summary: z.string().describe('A detailed text summary of the analysis, including land feature classification, points of interest, relevant current news, and temporal context.'),
To implement contextual visualizations for resolution search, you need to modify the data flow from the AI agent through to the UI components. Here's a step-by-step analysis:
Implementation Steps
Step 1: Update the Schema to Include Contextual Labels
Add fields to resolutionSearchSchema in lib/schema/resolution-search.ts to store contextual labels for each image type:
export const resolutionSearchSchema = z.object({
summary: z.string().describe('A detailed text summary of the analysis, including land feature classification, points of interest, relevant current news, and temporal context.'),
// Add these new fields:
mapboxImageLabel: z.string().optional().describe('A contextual label describing what the Mapbox image shows, based on the analysis focus.'),
googleImageLabel: z.string().optional().describe('A contextual label describing what the Google Satellite image shows, based on the analysis focus.'),
analysisFocus: z.string().optional().describe('A brief phrase describing the primary focus of the analysis (e.g., "Urban infrastructure analysis", "Forest coverage assessment").'),
// ... existing fields
})
Step 2: Enhance the System Prompt
Modify the system prompt in lib/agents/resolution-search.tsx to instruct the AI to generate contextual labels. Add this to the Analysis Requirements section:
**Analysis Requirements:**
// ... existing requirements 1-7
8. **Contextual Labeling:** Generate descriptive labels for the map images that reflect the analysis focus. If user-drawn features are present, reference them in the labels. For example:
- If analyzing a drawn polygon: "Analysis of drawn area: [feature type]"
- If analyzing a specific location: "[Location name] satellite view"
- If general analysis: "[Primary feature type] analysis"
Provide these in the mapboxImageLabel, googleImageLabel, and analysisFocus fields.
Step 3: Pass Labels Through AI State
In app/actions.tsx, the analysis result is stored in the AI state at lines 191-199. The new schema fields will automatically be included in the analysisResult object, so no changes are needed here—the data will flow through automatically.
Step 4: Update ResolutionCarousel Props
Modify the ResolutionCarouselProps interface in components/resolution-carousel.tsx to accept the contextual labels:
interface ResolutionCarouselProps {
mapboxImage?: string | null
googleImage?: string | null
initialImage?: string | null
// Add these new props:
mapboxImageLabel?: string
googleImageLabel?: string
analysisFocus?: string
}
Step 5: Update Carousel Label Logic
Replace the static label generation in components/resolution-carousel.tsx (lines 78-84) with dynamic labels:
// Individual slides
if (mapboxImage) slides.push({
type: 'image',
src: mapboxImage,
showAnalysis: false,
label: mapboxImageLabel || '
Wiki pages you might want to explore:
- [Resolution Search and Image Analysis (QueueLab/QCX)](/wiki/QueueLab/QCX#2.6)
- [Glossary (QueueLab/QCX)](/wiki/QueueLab/QCX#7)
I understand you're asking about making the resolution search visualizations more contextual to user needs and queries. Currently, the resolution search captures map images and displays them in a carousel, but the response doesn't clearly indicate what the analysis is focusing on or how it relates to the user's specific context. 1 2
Current State
The resolution search system captures map images (Mapbox and/or Google) and analyzes them with the
resolutionSearchagent, which includes context like:However, the visualizations displayed in the
ResolutionCarouseluse generic labels like "Mapbox Capture" or "Google Capture" without explicitly referencing what the analysis is focusing on. 7Making Visualizations More Contextual
To address this, you could enhance the system prompt in
resolutionSearchto make the summary more explicitly contextual about what it's analyzing:Additionally, you could modify the
ResolutionCarouselto accept context-aware labels based on the analysis results, rather than static labels. 1The response schema already supports contextual information through the
summaryfield which should include land feature classification, points of interest, and relevant context. 8Notes
The current implementation does include contextual information in the analysis (drawn features, location, news, time), but the visual presentation in the carousel doesn't explicitly surface this context to users. The enhancement would focus on making the summary text more explicit about what is being analyzed and potentially updating the carousel labels to reflect the analysis focus.
Wiki pages you might want to explore:
Citations
File: components/resolution-carousel.tsx (L110-151)
File: lib/agents/resolution-search.tsx (L101-135)
File: lib/schema/resolution-search.ts (L8-10)
To implement contextual visualizations for resolution search, you need to modify the data flow from the AI agent through to the UI components. Here's a step-by-step analysis:
Implementation Steps
Step 1: Update the Schema to Include Contextual Labels
Add fields to
resolutionSearchSchemainlib/schema/resolution-search.tsto store contextual labels for each image type:Step 2: Enhance the System Prompt
Modify the system prompt in
lib/agents/resolution-search.tsxto instruct the AI to generate contextual labels. Add this to the Analysis Requirements section:Step 3: Pass Labels Through AI State
In
app/actions.tsx, the analysis result is stored in the AI state at lines 191-199. The new schema fields will automatically be included in theanalysisResultobject, so no changes are needed here—the data will flow through automatically.Step 4: Update ResolutionCarousel Props
Modify the
ResolutionCarouselPropsinterface incomponents/resolution-carousel.tsxto accept the contextual labels:Step 5: Update Carousel Label Logic
Replace the static label generation in
components/resolution-carousel.tsx(lines 78-84) with dynamic labels: