This work was done in collaboration with Safe Software partner Solutial
Learn how to integrate ChatGPT with FME Form to extract data from descriptive memorials in PDF format and transform it into spatial geographic objects. Using the OpenAIChatGPTConnector, this process identifies vertices and generates polygons in Well-Known Text (WKT) format, streamlining data extraction, minimizing token usage, and automating workflows with ease.
AI and FME: Text to WKT Polygon Transformation
AI is transforming the way we interact with digital tools, unlocking endless possibilities—from simple calculations to advanced tasks like text analysis and pattern recognition.
When it comes to managing data, AI offers powerful solutions to address common challenges such as encoding errors, misspellings, and inconsistent text formatting. One area I’ve explored extensively is text analysis. Initially, I relied heavily on regular expressions (Regex) for most tasks.
Integrating ChatGPT into my workflows has greatly simplified and enhanced the process. For example, I’ve used AI to analyze descriptive memorials, process property registration data, trace ownership history, and even calculate area percentages from image-based PDFs. Combining FME with AI takes these possibilities to new heights.
In this post, I’ll share a practical example: extracting text from a descriptive memorial PDF, using ChatGPT to identify vertices, and generating a WKT polygon as the final output.
Step 1: Understanding FME Form Readers
FME Form offers various readers, including one for PDF files. I found a public descriptive memorial document online to serve as an example and analyzed its structure and characteristics.
Traditionally, processing such documents required manual inspection, text pattern identification, and Regex-based extraction logic. By integrating ChatGPT, the workflow becomes more efficient and user-friendly.
Using the PDF reader in FME Form, I opted for block-based reading. FME Form interprets the PDF as a geographic document, treating the page boundaries as edges of an A4 layout.
Step 2: Preparing Extracted Text
After extracting the text, I processed it to ensure lines were properly joined and correctly ordered. This was critical because the document spanned two pages, requiring careful handling to ensure complete and structured text.
Step 3: Integrating ChatGPT
With the text prepared, I used the OpenAIChatGPTConnector transformer to send the content to the OpenAI API. This integration enabled FME Form to interact with ChatGPT and receive the required output—a WKT polygon describing the memorial.
Key Tips for OpenAIChatGPTConnector
- Account Requirement: You need an OpenAI account for integration. Sign up if you don’t have one.
- Be Specific: When formulating prompts or instructions for ChatGPT, be clear and concise. This minimizes token usage and ensures efficiency.
- Token Management: Both inputs and outputs are converted into tokens. Using shorter prompts reduces costs.
Step 4: Final Outcome
At the end of the process, the WKT is generated. Using the GeometryReplacer transformer, the text is converted into a spatial object, completing the workflow.
Learn more about the ways FME can help you by visiting the solutions page. Check out Solutial’s partner page to discover more about their journey with FME.
If you want to keep learning about FME and AI, check our AI-powered Enterprise Integration Solutions page.