Using Generative AI for Geospatial Data Processing in FME (with 6 Examples)

Liz Sanderson
Liz Sanderson
  • Updated

Introduction

The AI revolution is changing the game in geospatial data processing in unexpected ways. Across sectors, we’ve seen it streamline business processes, boost productivity, and improve decision-making. Want help creating or editing content? Done in seconds. Need a summary of a massive document? Here you go. Wishing you had a personal assistant to do research, bounce ideas off of, and do mundane tasks? It can do that, too.

As we strive to understand the role and power of AI, some people are panicking that robots are coming for everyone’s jobs (I admit, I held a bit of this fear myself)—but the reality is far from it. Instead, it’s proving to be a tool to make everyone’s jobs easier. Even with the most powerful AI, humans still need to create prompts and interpret the results, which means prompt engineering is becoming a skill for the resume. If you’ve tried using ChatGPT for anything advanced, you know what I mean: using it takes practice.

When working with geospatial data, generative AI can be an incredible help, enabling advanced data extraction, automating analysis for better decision-making, and improving predictive modeling. The trick is knowing how to incorporate it into data integration workflows—which is where the new FME AI connectors come in.

FME can integrate with various APIs and formats, transform data, and handle data distribution. AI is one piece of the workspace, helping you to get more valuable results.

Adding generative AI into your FME workflows is as easy as adding any other reader, writer, or transformer to the canvas. At the time of writing, these are FME’s tools for working with generative AI:


These transformers enable a conversational approach to AI prompting via GPT-4 and GPT-3.5 Turbo.
 

Time to master a new skill: Writing killer prompts

To get the most out of AI, it’s necessary to understand how to create prompts that will generate the most useful results. This is a learning curve. Until you build that skill, the results will leave you squinting at the screen and wondering what all the fuss is about.

A few important things to consider:

  • Prompts should be long and detailed. The more time you spend spelling out precisely what you want the AI to do, the better the result will be. Unlike search engines, it’s not about throwing in a few keywords but providing long, detailed instructions.
  • Add context. Giving the AI context to your prompt can be a game-changer. This means opening the conversation with something like “You are a geospatial engineer” or “You are an award-winning technology journalist” along with some other important backstory to what you’re about to ask.
  • The AI’s “database” is static. AI doesn’t query live data from around the internet. Currently, the information ChatGPT has is pre-September 2021. Think of it like a huge database that you query using natural language. This limitation will probably change, especially given that there’s already a “web browsing” mode in ChatGPT Beta—but for now, this is a caveat worth keeping in mind.
  • The results can be wrong. AI technology isn’t perfect. While generative AI can be super helpful, treat the results cautiously and ensure a human verifies them.


Let’s dive into some examples. These come from our recent webinar, Latest Advances in Generative AI: Exploring New Technology for Data Integration, which you can watch to see the full demos and discussion.
 

Example 1: Prompting with context in the OpenAIChatGPTConnector

In the OpenAIChatGPTConnector parameters, different fields can provide information to the AI, including the role, message history, and a unique conversation ID.

Screenshot 2023-05-23 at 11.06.37 AM.png

For example, we can send the following prompts:

  1. You are a bot that generates company profile datasets.” (sent under the “system” role, which is used to initialize behavior)
  2. “Generate me a json file that contains the 10 most valuable companies and returns "company name", "number of employees", "revenue", "profit", and "valuation".  Name the columns company, employees, revenue, profit, and valuation. Only return the raw json in the answer.”


By prompting the AI with context and the chat history, we can get more useful results than if we simply send one prompt asking it to generate a JSON file.
 

Example 2: Generating geospatial datasets with automated context

FME’s new Generative AI Reader does much of the prompting legwork automatically. In the parameters, simply type what you want. The reader will generate the field names and rows.

For example, we can ask it for the following information:

“​​All CFL teams, their team name, their stadium name, city name, the stadium location. Oh yes, also their annual revenue and average game attendance”

The dataset we get back looks like this when opened in Visual Preview:

Screenshot 2023-05-23 at 10.25.44 AM.png

As mentioned above, the data comes from whatever the AI knows from its training data, which is currently pre-September 2021. As ChatGPT improves and can take into consideration up-to-date information from around the internet—perhaps even be trained on your company’s data—we can see this type of scenario being much more useful.

Here’s another set of prompts. First, let’s ask for an informative dataset of all the US states:

“All 50 US State names, their 2 letter code, an example zipcode in each, and the capital city”

Screenshot 2023-05-23 at 10.25.33 AM.png

Now let’s use this data in this second prompt:

“The top 10 companies by revenue in @Value(capital), @Value(state), with their company headquarters address, number of employees, and industry”

So, for every row in the previous dataset, we will run this query. Here is the result for Boise, Idaho:

Screenshot 2023-05-23 at 10.25.51 AM.png

Here is the result for all cities and states:

Screenshot 2023-05-23 at 10.26.01 AM.png

This is a great example of how we can chain together queries to generate more useful, comprehensive results. The context added by the reader will be a huge time saver, enabling you to simply type in what sort of dataset you want and get it back within seconds. You can then process and distribute the data in any of FME’s supported formats.
 

Example 3: Generate images using Leap AI

FME has two transformers for generating AI images: OpenAIImageGenerator and LeapAIConnector. They are both straightforward to use, accepting a prompt and contextual parameters such as the size. Here’s an FME Lizard-Zipster mutant it generated during the webinar:

Screenshot 2023-05-23 at 11.30.27 AM.png

 

Example 4: Create an app for self-serve document processing

Tensing has developed several tools that leverage generative AI in FME. Accessible via a web interface, they enable end users to upload a document and get back an AI-generated summary. These tools can also be accessed in FME via these transformers:

This is a great example of how AI can be integrated in an FME workflow to empower end users to use it for a specific scenario. In this case, an end user can upload a document and get back a summary, keywords, and even locations from the document for use in geospatial analysis.


Try the PDF summarizer app
 

Example 5: Another app for extracting locations from PDF maps

Tensing also created a workflow to automate location extraction from embedded PDF maps, which includes the following steps:

  1. Use Azure Cognitive Services to read a PDF and extract maps as images
  2. Use Amazon Rekognition to Extract place name labels as text blocks
  3. Use OpenAI to request coordinates for the place names as text
  4. Use FME to integrate all AI responses, prepare a map, and geolocate the places

They have also made this available as a web app.
This scenario illustrates how different services can be integrated using FME, creating a very powerful workflow that empowers end users to leverage AI.

GeocodeExtractedText-workspace-app.png
Try the PDF map extraction app

Visit the Tensing Labs page for all of their apps.
 

Example 6: Generate regex, SQL, and Python queries

Currently under development in FME: we’re considering how we can let AI help users write regular expressions, SQL, and Python. Functionality would include:

  • An assistant to generate and refine code/queries based on natural language inputs.
  • An explanation pane to help you understand what the code is doing.


For example, a user hoping for SQL help could type:

from us_counties, find the county that is most rainy, the result should contain the county name, the county population , the annual rain, the annual snow and average temperature

And the AI would return:

SELECT county_name, pop, annulrain, annulsnow, avetemp FROM us_counties WHERE annulrain = (SELECT MAX(annulrain) FROM us_counties) GROUP BY county_name, pop, annulrain, annulsnow, avetemp;

Let us know if you’re interested in this and any other AI-related functionality. Many of us already use ChatGPT to generate queries in these languages, so we’d like to embed this into FME to help speed up the authoring experience.
 

Try it!

Using generative AI for geospatial data processing can enhance workflows and decision-making processes, enabling tasks that were previously tedious, complex, and even impossible. Let us know how you’re using this new functionality, and check back for more updates!

Download the latest version of FME to get started

For more examples and step-by-step guides, check out our Tutorial: Getting Started with OpenAI in FME.

How are you using generative AI in FME? What are your biggest challenges? Let us know!

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.