Skip to main content
Question

Reading labels, healing contours with AI

  • May 4, 2026
  • 2 replies
  • 47 views

dmitribagh
Safer
Forum|alt.badge.img+19

Hi All,

I keep exploring Gemini’s spatial vision capabilities. Here is another example — a simple geology map of isolines with lots of hand-written labels on them. Can Gemini read these labels? 

The image "as is" is too big for AI, so FME has to do some work first.

If I resample the image to AI-suitable sizes, the labels will be 3-4 pixels high, then even a human won’t be able to read them. Tiling is the only way to preserve the label pixels. I tile the raster into 1024×1024 chunks — the size Gemini likes — and send them to the AI. But I don't ask it to read the labels yet because the results weren’t great — I’ve got a lot of misread or missed labels. Instead I ask for the pixel coordinates of each label, which I turn into points, then buffer them into tiny clippers — each one just big enough to fit a single label. I can pack a few hundred of these tiny rasters into a single request, which, for this sheet, was a very reasonable 370 KB. I ask for text and rotation in the response, and since I already have coordinates from the previous step, I have my labels!

I also decided to try one more operation — can we heal the gaps in the isolines with Gemini? It seems like we can. Most gaps close cleanly, and the lines shed a lot of the scan's irregularities along the way.

Was this process perfect? No — we still cannot pass this work to AI blindly. The label rotation wasn't too great (and FME is not the best labelling engine, so I decided not to rotate labels in my video). Outside the map frame, Gemini hallucinated a few extra isolines — very convincingly. There's also one spot inside the map where it got “creative”. In general, however, the results are quite good, and suitable for vectorization (yellow lines at the end of the video), and for a spatial overlay to pass extracted label values to isolines.

Considering the amount of manual work in this process, curated AI is absolutely worth it. I feel like Gemini, with its remarkable spatial vision, becomes a handy cartographic tool. With the FME’s supportive hand, of course.

Dmitri
 

 

2 replies

janrykr
Contributor
Forum|alt.badge.img+9
  • Contributor
  • May 4, 2026

Great work ​@dmitribagh !

Can’t tell from your video - Are the vectorized isolines attributed with the elevation extracted from the label? If not - maybe it is a next step?

Another challenge - georeferencing the raster or the output vectors? 
 


dmitribagh
Safer
Forum|alt.badge.img+19
  • Author
  • Safer
  • May 4, 2026

Great work ​@dmitribagh !

Can’t tell from your video - Are the vectorized isolines attributed with the elevation extracted from the label? If not - maybe it is a next step?

Another challenge - georeferencing the raster or the output vectors? 
 

Hi ​@janrykr 

I actually took it further, overlaid labels on the vectorized isolines (they are some geology lines, not contours) and built a 3D model, however, the source lines themselves are not so great with some spots where they cross each other, so the result was not that great. I’ll play with it a bit, and if I get a cleaner result, I’ll publish it here, too.

 

About georeferencing. If the source image is georeferenced, we don’t lose it - before processing with Gemini, I extract raster properties and CS, and then put all the tiles back together and mosaic using this info, so at the end everything is properly placed correctly in the world.

 

If there is no georeferencing info, check my older post here:

Of course, this sort of maps has clear indication of how to georeference them, so it is not a universal recipe, but if there is something in the map to rely on, it’s totally possible.

 

Dmitri