Question

OpenAIOSMReader

  • 7 March 2024
  • 0 replies
  • 11 views

Userlevel 4
Badge +13
FME Hub user dmitribagh just uploaded a new transformer to the FME Hub.

takes the extents and a simple text input in a form of comma- or semicolon-separated list of objects which a user would like to extract from OpenStreetMap database.

This is a highly experimental transformer and should rather serve for inspiration and experimentation than real work - the current results generated by OpenAI API do not always return the expected or satisfactory results.

As an experimental transformer, it wasn't passed through a thorough QC process, it does not handle all possible errors or exceptions. Feel free to look inside and edit the transformer as much as your imagination allows and adjust it for your needs.

How does it work?

The transformer populates a pre-created prompt with parameters such as extents of the are of interest, and the keywords defining the objects that will be read from the OSM database. The prompt is submitted to OpenAI API, which turns it into a Overpass QL (Query Language) query. This query then is sent to the OSM API and returns an OSM XML data, which gets saved and immediately read back serving as an output of the transformer.

Usage Notes

OpenStreetMap (OSM) data is characterized by its flexible, community-driven approach to tagging, which allows for a rich and varied set of attributes to describe the vast array of geographic features in the database. Tags in OSM consist of key-value pairs attached to nodes, ways, and relations, enabling detailed and specific descriptions of locations, objects, and their attributes. This flexibility allows mappers from around the world to contribute data that is locally relevant and nuanced, although it also leads to variability in tagging practices. The diversity of tags reflects the global community's contributions and necessitates adaptable data processing approaches to accommodate the wide range of possible attributes and values that might be encountered when working with OSM data. Because of this, the transformer expose only one attribute, "name", which might or might not be present on the output features. Exposing other attributes is up to the users.

You can request some large categories, for example, "roads", "schools", "buildings". Or something quite narrow, for example, "sport stores" or "sushi".

Invalid requests ("Give me something cool") or requests that do not return results, output the original geometry and an error message explaining what was wrong.

Refer to Overpass API guidelines about rates and volumes.

Configuration

Input

The transformer can take any features as an input - they will be discarded if the request returns results or preserved if the request is invalid or does not yield any results.

Output

A OSM dataset within the specified extents (some area and linear features can go outside the extents). Each feature gets an fme_feature_type attribute, which is reflects large categories of OSM features, and a name attribute exposed within the transformer. It might or might not be present of the features. The users may need to add another AttributeExposer after inspecting the transformer's output to add more attributes to the feature_type schema.

Parameters

OpenAI API Key

The API key provided by Open AI. The translation will fail if no key or invalid key is provided.

Model

OpenAI model.

Extract Features Containining Keywords (Attributes and Tags)

A comma or semicolon separated list of objects to extract from the OSM database.

Elements to Include

Select a combination of elements for the output. The elements are defined as follows:

Nodes: Represent specific points on the map, such as locations of interest or landmarks. Nodes are the simplest form of data in OSM, marking a single geographic point with associated tags to describe the feature.

Ways: Define linear features and area boundaries, such as roads, rivers, or the perimeter of parks. Ways are sequences of nodes that create a polyline or polygon when the first and last nodes are the same.

Relations: Describe more complex relationships between elements (nodes and ways) or group them to represent multi-part geometries, routes, or areas with holes. Relations are used for sophisticated mapping needs that single nodes or ways cannot adequately capture.

For most searches, "Nodes, Ways, and Relations" is a good option.

Include Non-Feature Nodes (Vertices)

Include or exclude nodes that make linear and area features and don't carry meaningful feature attributes.

Bounding Box Group

Includes four bounding box coordinates defining the extents of the search rectangle. They can be taken from attributes or typed in.



Would you like to know more? Click here to find out more details!

This post has been closed for comments