Takes a text input representing a geographic location, and creates a center point and a bounding box around it with a number of attributes characterizing the location.
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 takes a text string or a text attribute as an input, and sends a detailed prompt to OpenAI API. The prompt includes the requirements to the found location and the necessary actions if the location is not found. It also describes the attributes that should be added to the result. The request goes to the API and returns back a GeoJSON, which is then turned into geometries and a set of attributes.
Usage notes
The transformer can create geometries for almost any kind of location, however, with different levels of success. For example, it can create a geometry for a well-known street, such as Broadway in Vancouver, but will fall back to the city level for a less known street. It can identify and create geometries for famous landmarks, countries, mountains, and all kinds of other geographic features. Moreover, it can create geometries and attributes for crossword-like clues, for example, "the biggest city halfway between Calgary and Edmonton" or "The deepest freshwater lake in the world," or even "a state to the east from Washington state". The transformer also "understands" different languages; for example, it can correctly create an output for the word "Київ" (the capital of Ukraine).
The transformer does not necessarily output an accurate bounding box or a center point for any location. In some cases, OpenAI has only limited knowledge about the extents of a location, or its boundaries might not be well-defined in general (the Sahara desert, for example). Always keep in mind that the output shows an approximate location and cannot be relied upon when an accurate geometry is needed.
Configuration
Input
The transformer can take any features. All input geometries are removed and new geometries are added (a point and a bounding box). The search text can be typed in the transformer or taken from an attribute
Output
A point and a rectangle geometry of a bounding box around the input location with a set of identical attributes:
Name - the English name of the location
NameLocal - the name of the location in the local language
MatchLevel - the level, at which the location was identified (e.g., Street, City, Region, etc.)
Confidence - the evaluation of how accurate the location was identified. Possible values are "High", "Medium", "Low". For example, if in a location request consisting of a street name and a city, the street wasn't identified, but the city was found successfully, the "Confidence" will be set to "Medium".
AdministrativeUnit - if possible, the name of an administrative unit (such as state, province, land etc) containing the location is set. For larger features stretching across multiple administrative units this attribute won't be set.
Country - like AdministrativeUnit, this attribute is only set when it makes sense, that is, the location is enitrely inside a country
Note - this is a free-style text generated by OpenAI with some additional information about the location
Pronunciation - the English pronuncation of the location name.
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.
Location
A text description or an attribute value with location information to process through the API.
Would you like to know more? Click here to find out more details!