TerraSight Offline Satellite Analysis Powered by Gemma 4 **Summary:** TerraSight is an offline geospatial analysis tool that processes raw Landsat 9 satellite data on a user's local machine to compute vegetation health (NDVI), urban coverage (NDBI), and land surface temperature (LST). It uses Google's Gemma 4 E4B model, running locally via Ollama, to provide contextual AI explanations of the computed statistics without requiring cloud processing or GIS expertise. The tool is designed for non-specialists like farmers and students, ensuring data privacy by keeping all analysis and AI inference on the user's hardware. This is a submission for the Gemma 4 Challenge: Build with Gemma 4 What I Built TerraSight is a geospatial analysis tool that runs entirely on your machine. You upload raw Landsat 9 satellite band files, draw a study boundary, and the app computes three indices: NDVI vegetation health , NDBI urban surface coverage , and LST land surface temperature , then renders calibrated colour maps and lets you interrogate the results through an AI chat interface. No cloud processing. No API keys. No data leaving your machine. The problem I was solving is straightforward: satellite imagery analysis has always sat behind expensive software licenses ENVI, ArcGIS or required GIS expertise most people don't have. Farmers checking crop stress, students doing fieldwork, community researchers tracking urban heat, they don't need a commercial GIS suite. They need something that takes a file, does the math correctly, and explains what the numbers mean in plain language. That last part is where Gemma 4 comes in. Demo Code GitHub: github.com/HysterAlan1/terrasight-geoai https://github.com/HysterAlan1/terrasight-geoai The project is split into two files by design: - gis engine.py — all geospatial computation, radiometric scaling, and AI logic. No Streamlit. You can import it directly into a notebook or script. - app.py — the Streamlit UI. It calls the engine, handles session state, and renders everything. Nothing that touches pixels lives here. The processing pipeline applies official USGS Collection 2 Level-2 scale factors to convert raw digital numbers into physical values: Optical bands → surface reflectance reflectance = np.clip DN 0.0000275 - 0.2, 0.0, 1.0 Thermal band → Celsius lst = DN 0.00341802 + 149.0 - 273.15 Pixels where any optical band reads zero get masked to NaN before any index is computed. This matters — skipping that step would quietly corrupt NDVI and NDBI values for no-data areas without raising any error. How I Used Gemma 4 I used Gemma 4 E4B running locally via Ollama. The choice of E4B was deliberate. The use case is offline; the whole point of the tool is that your satellite data stays on your machine. E4B runs comfortably on consumer hardware without a GPU, which means it works on the kind of laptop a park ranger or agriculture student actually has. A larger model would have defeated the purpose. Gemma 4 handles two things in TerraSight: 1. Contextual interpretation Every time a user sends a message in the AI terminal, Gemma receives the actual computed statistics, not just the question, as part of its context: prompt = f"NDVI={mean ndvi:.3f}, NDBI={mean ndbi:.3f}, LST={mean lst:.1f}°C, " f"location={place}. User asks: {user input}. Answer concisely." This means the model's answers are grounded in the real numbers from that specific scene, not generic satellite literacy. Ask it, "Why is the LST so high in the centre?" and it answers in terms of the actual value you computed, not a textbook definition of urban heat islands. 2. Graceful degradation I also built a keyword-based rule engine that fires when Ollama is unreachable. It interprets the three index values using threshold tables and routes the answer based on what the user appears to be asking. This means the tool remains fully functional without AI Gemma, but the analysis doesn't break without it. What I found working with E4B: it handles domain-specific questions well when the numbers are injected directly. Vague prompts get vague answers. Specific prompts, "NDVI=0.21, location=Lagos, why is vegetation this low?", get genuinely useful responses. The model responds well to being given context rather than being expected to know it. Why This Project Matters Most satellite analysis tools assume you already understand the data. They display a map and leave interpretation to the user. TerraSight flips that the map is secondary to understanding what the map means. That shift matters most for the people who aren't GIS professionals but still have legitimate reasons to analyse land cover: a farmer assessing crop stress after a dry month, a local government tracking heat island growth, a student building a remote sensing project for the first time. None of them needs ENVI. They need something that takes their files, applies the correct math, and tells them what they're looking at. Gemma 4 E4B makes that possible without a cloud subscription or a data privacy tradeoff. The model is small enough to run locally, capable enough to interpret geospatial statistics coherently, and fast enough that the chat interface feels responsive rather than like waiting for an API call. Built with Python, Streamlit, Rasterio, GeoPandas, and Gemma 4 E4B via Ollama. Data from USGS EarthExplorer Landsat 9 Collection 2 Level-2 .