The Community
The community I built this for is a specialized and adventurous one: Field Geologists, Structural Geologists, Petrologists and Earth Science educators.
These are the scientists who venture into remote mountain ranges, desert canyons, and coastal cliffs to read Earth's story—not from hand samples alone, but from entire outcrops. A single rock face can reveal millions of years of geological history: ancient magma intrusions, weathering events, tectonic forces, and even the co-evolution of life and the planet (as the app notes: "Nearly two-thirds of Earth's 5,000-plus mineral species owe their existence to the rise of oxygen-producing life").
Their challenge is unique. While a hand sample fits in your pocket, an outcrop is a wall of information—meters high and wide. Interpreting it requires:
· Identifying different rock units and their relationships
· Estimating volume percentages of different materials
· Understanding cross-cutting relationships (which rock is older?)
· Recognizing structural features (fractures, folds, dykes)
· Synthesizing all this into a coherent geological story
Traditionally, this requires years of training, detailed field sketches, note-taking, and mental reconstruction. This community needed a tool that could see the outcrop like a geologist and provide instant, structured analysis in the field.
What I Built
I built GeoGemini PetroLab(unpublished), an AI-powered outcrop analysis system with a Deep Reasoning Expert Consult feature.
· The Project: A web application where a Geologist uploads a photo of a rock outcrop (like a cliff face or road cut). The AI analyzes the entire scene, identifies different Geological units, estimates their volume percentages, describes their features, and synthesizes this into a professional petrographic report. Additionally, a Scientific Consultation mode allows users to ask deep Geological questions about concepts like Bowen's Reaction Series, twinning mechanisms, or birefringence.
· The Problem it Solves: It bridges the gap between field observation and geological interpretation. By providing instant, structured analysis of entire outcrops, it accelerates field mapping, improves the accuracy of geological interpretations, serves as a powerful teaching tool, and even offers on-demand expertise for complex Petrological concepts.
· The Role of AI (Google Gemini): The core intelligence is powered by the Google Gemini API. I engineered two complementary AI systems:
Modal Analysis System: This instructs Gemini to act as a Field Petrologists analyzing an outcrop image. It must:
· Identify distinct lithological units (e.g., "Oxidized Host Rock," "Dark Vein/Dyke Material")
· Estimate their volume percentages based on visual prominence in the outcrop
· Describe their key visual features (color, structure, fracture patterns, contact boundaries)
· Synthesize all observations into a coherent "Petrographic Summary" that interprets the geological story
· Generate an EXPORT / SHARE ready reportDeep Reasoning Expert Consult: This transforms Gemini into a Geological reasoning engine that can discuss:
· Bowen's Reaction Series (the sequence of mineral crystallization from magma)
· Twinning Mechanisms (crystal growth phenomena)
· Birefringence Explanation (optical properties of minerals under a microscope)
· Phase diagrams, thermodynamic stability fields, and lithological classifications
Demo: Two Powerful Modes
Here is GeoGemini PetroLab in action. The two screenshots below show the complete system.
Mode 1: Outcrop Modal Analysis
In this mode, a Geologist uploads a photo of a rock outcrop. The image shows a steep, weathered rock face with two figures at the base for scale (indicating the outcrop is several meters high). The AI instantly generates:
· Modal Composition (VOL%):
· Oxidized Host Rock (85%): "The dominant country rock... Its coloration suggests significant weathering and iron oxide staining (limonite/goethite)." Key features: YELLOWISH-BROWN TO ORANGE-HUE, HEAVILY FRACTURED, MASSEY STRUCTURE
· Dark Vein/Dyke Material (15%): "Distinct dark bands traversing the host rock. These appear to be intrusions, such as mafic dykes but here is coal layer... contrasting sharply with the oxidized host." Key features: BLACK, SHARP CONTACT BOUNDARIES
· Petrographic Summary & Synthesis: A professionally written Geological interpretation: "The image captures a macroscopic outcrop scale view... The exposure consists of a steep, weathered rock face dominated by yellowish-brown, oxidized host rock. Cutting through this matrix are several prominent, dark black bands that branch and weave through the strata, interpreted as dykes or coal veins... The texture is rough and fractured."
This transforms a single photograph into a complete field notebook entry—ready to EXPORT or SHARE with colleagues.
Mode 2: Deep Reasoning Expert Consult
In this mode, the geologist can engage with an AI petrology expert to discuss fundamental concepts:
· Bowen's Reaction Series: Ask about the sequence of mineral crystallization from magma in case of Igneous rocks.
· Twinning Mechanisms: Explore crystal growth phenomena and their significance
· Birefringence Explanation: Understand optical properties of minerals under polarized light
· Phase Diagrams: Discuss thermodynamic stability fields of minerals
· Lithological Classifications: Get help with complex rock classification questions
The interface notes a profound geological insight: "NEARLY TWO-THIRDS OF EARTH'S 5,000-PLUS MINERAL SPECIES OWE THEIR EXISTENCE TO THE RISE OF OXYGEN-PRODUCING LIFE. DEMONSTRATING A PROFOUND CO-EVOLUTION BETWEEN THE BIOSPHERE AND THE GEOSPHERE." This sets the stage for deep, interdisciplinary conversations about Earth's history.
Code
The code for GeoGemini PetroLab is available on GitHub. It's built as a React/TypeScript application that wraps the Google Gemini API with specialized prompts for both modal analysis and deep reasoning.
--> https://github.com/rajamuhammadyasinkhan2019-lgtm/GeoGemini-PetroLab <--
How I Built It
I built GeoGemini PetroLab with a focus on scientific accuracy, professional presentation, and dual-mode functionality.
· Frontend & Framework: TypeScript and React for a robust, type-safe user interface with a clean laboratory-style aesthetic.
· Core AI Integration: Google Gemini API with two specialized prompt engineering systems:
· Modal Analysis Prompts: Designed to extract quantitative (volume %) and qualitative (texture, color, structure) data from outcrop images
· Deep Reasoning Prompts: Engineered to engage in expert-level discussions of petrological concepts
· Key Features:
· Image upload with scale recognition (the AI identifies human figures for scale)
· Modal composition calculation (volume % estimation of different rock units)
· EXPORT / SHARE functionality for field reports
· Scientific Consultation mode with quick-access topics (Bowen's Series, Twinning, Birefringence)
· Scientific Foundation: The app includes real geological insights, like the fact that "Bridgemanite is the most abundant mineral on Earth, comprising approximately 35 percent of the planet's total volume" but is unstable at surface pressures—a fascinating fact that sets the stage for understanding mantle Geology.
· Build Tool: Vite for fast development and easy deployment.
What I Learned
Building GeoGemini PetroLab was a profound journey into the intersection of field geology and artificial intelligence.
· Technical Skills:
· Dual-Mode Prompt Engineering: The biggest technical achievement was creating two completely different AI personas within the same app—one that acts as a quantitative field analyst (Modal Analysis) and another that acts as a deep reasoning Petrology Professor (Expert Consult). This required fundamentally different prompt structures and output parsing strategies.
· Scale Recognition in Visual Data: Teaching the AI to recognize human figures in an image for scale reference was a fascinating challenge. The app's ability to note "Two figures at the base provide a scale reference, indicating the outcrop is several meters high" demonstrates sophisticated visual understanding.
· Volume Estimation from 2D Images: Getting the AI to estimate volume percentages from a 2D photograph of a complex 3D outcrop required careful prompt engineering to focus on visual prominence and areal extent.
· Scientific & Soft Skills:
· The Co-Evolution of Life and Rocks: The app's opening fact about minerals owing their existence to oxygen-producing life taught me something profound. It's a reminder that Geology isn't just about rocks—it's about the interconnected story of Earth. This perspective influenced how I designed the Expert Consult mode to handle interdisciplinary questions.
· Bridging Field and Theory: Geologists often work in two worlds: the messy reality of the field and the clean theory of textbooks. GeoGemini PetroLab bridges these by providing both outcrop analysis (messy reality) and expert consultation (clean theory) in one tool.
· The Importance of Exportable Science: Scientists need to share their work. The EXPORT / SHARE button wasn't an afterthought—it was a core requirement based on understanding how geologists collaborate and publish.
· Unexpected Lessons:
· AI's Ability to "See" Geology: I was genuinely surprised by the AI's ability to distinguish between "oxidized host rock" and "dark dyke material" in a complex, weathered outcrop. It correctly identified iron oxide staining (limonite/goethite) from color alone and recognized "sharp contact boundaries" as significant geological features.
· Deep Reasoning Capabilities: When testing the Expert Consult mode, I asked about Bowen's Reaction Series. The AI didn't just recite facts—it explained the implications for magma differentiation and rock formation in case of Igneous Rocks. This level of synthetic reasoning exceeded my expectations.
Your Google Gemini Feedback
The Gemini API was the engine that made GeoGemini PetroLab possible. Here's my honest, candid assessment.
· What worked well:
· Multi-Modal Understanding: Gemini's ability to analyze a complex scene with multiple Geological features (host rock, dykes, fractures, human scale figures) was outstanding. It correctly identified each element and understood their relationships.
· Scientific Terminology: The model demonstrated impressive command of Geological language—using terms like "mafic dykes," "iron oxide staining," "limonite/goethite," and "petrographic synthesis" appropriately and accurately.
· Dual-Persona Flexibility: The API handled the switch between quantitative analyst (Modal Analysis) and deep reasoning professor (Expert Consult) seamlessly, maintaining appropriate tone and content for each mode.
· The Good:
· Export-Ready Output: The structured nature of the API responses made implementing the EXPORT/SHARE feature straightforward. The Petrographic Report format emerged naturally from the AI's output.
· Context Retention: In Expert Consult mode, the AI remembered previous questions and could build on them, enabling natural conversations about complex topics like twinning mechanisms and phase diagrams.
· Speed: Analysis of high-resolution outcrop images was consistently fast—crucial for field use where Geologists need quick insights.
· The Bad / Friction Points:
· Volume Estimation Accuracy: Getting the AI to provide consistent volume percentages (like 85% host rock, 15% dyke material) was challenging. Early attempts produced wildly varying estimates for the same image. I had to engineer prompts that focused on visual prominence and areal coverage rather than attempting true 3D volumetric calculations.
· Mineral Specificity: In the outcrop analysis, the AI sometimes struggled to identify specific minerals beyond general categories (e.g., saying "mafic minerals" instead of identifying specific species like pyroxene or amphibole). This is understandable given the limitations of outcrop photos versus thin sections.
· The Ugly:
This was a stark reminder that AI is not infallible—Geologists must always verify with their own expertise. I added a disclaimer based on this experience.
· Terminology Inconsistency: The app screenshot shows "DARK VENUSYNE MATERIAL" which appears to be a unique or potentially hallucinated term. In practice, the AI sometimes invents mineral or rock names when uncertain. I had to implement confidence checks and fallback responses.
· Context Window Limits: Long Expert Consult sessions with multiple questions about phase diagrams and thermodynamic stability fields occasionally hit context limits, requiring session resets (hence the importance of a clean UI for starting fresh).
The Bigger Picture
GeoGemini PetroLab is more than just a tool—it's a vision for the future of Geological Field work. Imagine a Geologist standing before a towering outcrop, capturing an image, and instantly receiving a professional-grade analysis. Then, when they encounter a confusing texture or mineral, they can switch to Expert Consult mode and ask about twinning mechanisms or Bowen's Reaction Series—all from their phone or laptop in the field.
The app also reminds us of a profound truth: "Nearly two-thirds of Earth's 5,000-plus mineral species owe their existence to the rise of oxygen-producing life." Geology and biology are deeply intertwined. GeoGemini PetroLab helps scientists explore these connections at every scale—from a single crystal's birefringence to an entire outcrop's billion-year story.


Top comments (0)