Inferensys

Prompt

Geocoordinate Normalization Prompt

A practical prompt playbook for using the Geocoordinate Normalization Prompt in production GIS and logistics data pipelines.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for standardizing coordinate formats.

This prompt is for GIS specialists, logistics engineers, and data pipeline developers who need to convert a heterogeneous stream of geocoordinates into a single, predictable format for storage, analysis, or API consumption. The core job is to accept a coordinate string in any common notation—decimal degrees (DD), degrees-minutes-seconds (DMS), Universal Transverse Mercator (UTM), or Military Grid Reference System (MGRS)—and return a normalized decimal degree pair with a specified precision. The ideal user is building an ingestion pipeline where downstream systems (mapping libraries, geospatial databases, route optimizers) reject non-standard formats.

Use this prompt when you control the input string but cannot control its format, such as when ingesting user-submitted locations, scraping coordinates from reports, or merging datasets from different field collection tools. The prompt is designed to validate coordinate ranges, interpret hemisphere indicators (N/S/E/W, +/-, grid zone letters), and flag coordinates that fall outside an expected bounding box. It is not a geocoder; do not use it to convert addresses, place names, or landmarks into coordinates. For those tasks, use a dedicated geocoding API and then pipe the results into this prompt for final normalization.

Before deploying, define your precision requirement (e.g., 5 or 6 decimal places) and your expected bounding box. A logistics team tracking deliveries in Texas should set a bounding box that rejects coordinates in the Pacific Ocean, turning a silent data error into a reviewable flag. Always route low-confidence outputs or bounding-box violations to a human review queue rather than silently ingesting them. This prompt is a normalization step, not a data quality panacea—it will not fix coordinates that were collected incorrectly at the source.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Geocoordinate Normalization Prompt works well and where it introduces risk. Use these cards to decide if this prompt fits your pipeline before wiring it into production.

01

Good Fit: Multi-Format Ingestion

Use when: your pipeline ingests coordinates from field reports, user input, or legacy systems that mix DMS, UTM, MGRS, and decimal degrees. Guardrail: always pass the expected output precision and a bounding box constraint to catch coordinates that parse correctly but point to the wrong hemisphere or region.

02

Bad Fit: Survey-Grade Precision

Avoid when: you need centimeter-level accuracy or geodetic datum transformations. LLM normalization rounds to the specified decimal places but does not perform true datum shifts. Guardrail: route any coordinate requiring datum transformation (e.g., NAD27 to WGS84) to a deterministic GIS library, not a prompt.

03

Required Input: Bounding Box Context

What to watch: coordinates outside the expected area of interest silently pass validation if no bounding box is provided. A valid lat/lon in the wrong ocean is still valid. Guardrail: always include an expected bounding box in the prompt and flag any normalized coordinate that falls outside it for human review before ingestion.

04

Required Input: Precision Specification

What to watch: the model may return 10 decimal places when you need 5, or truncate when you need full precision for storage. Guardrail: explicitly state the target decimal precision in the prompt and add a post-processing validator that rejects outputs with incorrect precision before they reach the database.

05

Operational Risk: Hemisphere Ambiguity

What to watch: DMS formats that omit N/S/E/W indicators (e.g., '40° 42′ 46″') leave the hemisphere ambiguous. The model may guess based on context and guess wrong. Guardrail: require the prompt to return a confidence flag for hemisphere inference and route low-confidence results to a human review queue.

06

Operational Risk: Silent Hallucination on Garbage Input

What to watch: the model may return plausible-looking decimal coordinates even when the input is not a real coordinate (e.g., a phone number or address fragment). Guardrail: add a pre-validation step that rejects inputs with no recognizable coordinate pattern before they reach the normalization prompt, and log all rejected inputs for pattern analysis.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt with square-bracket placeholders for converting DMS, UTM, MGRS, and decimal degree variants to a standard format.

This prompt template is the core instruction set for normalizing geocoordinates. It is designed to be copied directly into your prompt management system, API call, or orchestration layer. The template uses square-bracket placeholders for all dynamic inputs, allowing you to inject the raw coordinate string, a target output schema, bounding box constraints, and a risk policy without rewriting the core logic. The instructions enforce a strict chain of operations: parse the input format, validate the coordinate ranges, convert to the target precision, and flag any values that fall outside expected boundaries.

code
You are a precise geocoordinate normalization engine. Your task is to parse a raw coordinate input, identify its format, validate its values, and convert it to a standard decimal degree representation.

[INPUT]

[CONSTRAINTS]

Follow these steps exactly:
1.  **Format Detection**: Determine if the input is in Decimal Degrees (DD), Degrees Minutes Seconds (DMS), Universal Transverse Mercator (UTM), or Military Grid Reference System (MGRS).
2.  **Value Extraction**: Extract the numeric components for latitude and longitude (or northing, easting, zone for UTM/MGRS).
3.  **Range Validation**: Check that extracted values are within valid ranges for their format. For DD, latitude must be between -90 and 90, longitude between -180 and 180. For UTM, easting must be between 100,000 and 999,999 meters. For DMS, minutes and seconds must be less than 60.
4.  **Conversion**: Convert the extracted values to Decimal Degrees with a precision of [PRECISION] decimal places. If the input is UTM or MGRS, perform the full projection conversion to WGS84 latitude and longitude.
5.  **Bounding Box Check**: If a bounding box is provided in [CONSTRAINTS], check if the final decimal degree coordinates fall within it. If not, set a `bounding_box_violation` flag to `true`.
6.  **Output Generation**: Return the result strictly according to the [OUTPUT_SCHEMA]. Do not include any explanatory text outside the JSON object.

[OUTPUT_SCHEMA]

To adapt this template for your application, replace the placeholders with concrete values at runtime. The [INPUT] placeholder should receive the raw, uncleaned coordinate string from your user or data source. The [CONSTRAINTS] placeholder is where you inject a natural-language description of your expected geographic area, such as "Coordinates must be within the continental United States (approx. 24°N to 49°N, -125°W to -66°W)." The [OUTPUT_SCHEMA] must be a strict JSON schema or a TypeScript interface definition that includes fields for the original input, detected format, decimal degree output, and any validation flags like bounding_box_violation. The [PRECISION] placeholder should be an integer, typically 5 or 6, to specify the number of decimal places required for your downstream GIS or logistics system. Avoid modifying the step-by-step instructions unless you need to add a custom validation rule specific to your data contract.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Geocoordinate Normalization Prompt. Each placeholder must be populated before the prompt is sent. Validation notes describe how to check the input before it reaches the model.

PlaceholderPurposeExampleValidation Notes

[RAW_COORDINATE]

The coordinate string to normalize. Accepts DMS, UTM, MGRS, decimal degrees, and common variants.

40°26′46″N 79°58′56″W

Non-empty string required. Reject null or whitespace-only input before prompt assembly.

[TARGET_FORMAT]

The desired output coordinate format. Controls the normalization path.

decimal_degrees

Must be one of: decimal_degrees, dms, utm, mgrs. Validate against allowed enum set.

[PRECISION]

Number of decimal places for decimal degree output. Ignored for non-decimal formats.

6

Integer between 0 and 10. Default to 6 if not provided. Clamp out-of-range values.

[EXPECTED_BBOX]

Bounding box for range validation. Coordinates outside this box are flagged.

{"west": -180, "south": -90, "east": 180, "north": 90}

Valid GeoJSON-style bounding box object. All four keys required. west <= east, south <= north. Null allowed to skip range check.

[HEMISPHERE_HINT]

Default hemisphere when input is ambiguous. Used when N/S or E/W indicators are missing.

N

Must be N, S, E, W, or null. Only applied when hemisphere cannot be parsed from [RAW_COORDINATE].

[SOURCE_CONTEXT]

Optional metadata about where the coordinate came from. Included in output for traceability.

field_survey_2024_borehole_17

String or null. No format constraints. Sanitize for log injection before storing in audit trail.

[OUTPUT_SCHEMA_VERSION]

Schema version for the output contract. Allows downstream consumers to handle format changes.

1.0.0

SemVer string. Validate against supported versions list. Reject unknown major versions.

PROMPT PLAYBOOK

Implementation Harness Notes

Wire the geocoordinate normalization prompt into a production pipeline with validation, retries, and bounding-box checks.

This prompt is designed to be called as a stateless function inside a data pipeline, API handler, or ETL job. The caller must supply the raw coordinate string, the expected precision, and an optional bounding box. The model returns a structured JSON payload that downstream systems can ingest directly. Because coordinate normalization is deterministic in principle but messy in practice, the harness must treat the model output as a candidate that still requires programmatic validation before it reaches a database or map service.

Wrap the prompt in a service that enforces a strict contract. Before calling the model, validate that the input is a non-empty string under 200 characters. After receiving the response, run a validator that checks: (1) the latitude and longitude fields are present and within [-90, 90] and [-180, 180] respectively, (2) the precision field matches the requested decimal places, (3) the format_detected field is one of the expected enum values, and (4) if a bounding box was provided, the normalized coordinates fall inside it. If the bounding-box check fails, route the record to a human review queue rather than silently accepting an out-of-area coordinate. Log every normalization attempt with the original input, the model's raw response, the validation result, and the final accepted or rejected status. This audit trail is essential for GIS and logistics teams who need to trace coordinate provenance.

Model choice matters. For high-throughput pipelines, use a fast model such as GPT-4o-mini or Claude Haiku with temperature set to 0. For ambiguous inputs that require reasoning about hemisphere defaults or MGRS grid zones, a more capable model may reduce the retry rate. Implement a single retry on validation failure: if the output fails schema or range checks, resubmit the same input with an additional instruction that includes the specific validation error. If the retry also fails, log the failure and route to the repair queue. Do not loop beyond one retry—coordinate strings that cannot be normalized in two attempts are likely malformed or require human interpretation. For regulated environments such as aviation or emergency services, always require human approval before normalized coordinates are used in operational systems, regardless of validation results.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the normalized geocoordinate output. Use this contract to validate model responses before ingestion into GIS, logistics, or mapping systems.

Field or ElementType or FormatRequiredValidation Rule

latitude_decimal

number

Must be a float between -90.0 and 90.0 inclusive. Precision must match [TARGET_PRECISION] decimal places.

longitude_decimal

number

Must be a float between -180.0 and 180.0 inclusive. Precision must match [TARGET_PRECISION] decimal places.

source_format

string (enum)

Must be one of: DMS, UTM, MGRS, DECIMAL_DEGREES, or UNKNOWN. Validate against detected input format.

original_input

string

Must exactly match the [INPUT_COORDINATE] string provided. Used for audit trail and downstream verification.

confidence_score

number

Must be a float between 0.0 and 1.0 inclusive. Flag for human review if below [CONFIDENCE_THRESHOLD].

bounding_box_check

object

If [BOUNDING_BOX] is provided, must contain 'in_bounds' (boolean) and 'bounding_box_name' (string). Set to null when no bounding box is supplied.

validation_warnings

array of strings

Each entry must be a non-empty string describing a specific normalization issue. Array must be empty if no warnings. Set to null only if validation was not performed.

normalization_notes

string

Must explain hemisphere resolution, precision rounding, or coordinate system conversion steps taken. Set to null if input was already in decimal degrees with no changes applied.

PRACTICAL GUARDRAILS

Common Failure Modes

Coordinate normalization fails in predictable ways. These are the most common production failure modes and how to guard against them before they corrupt downstream geospatial pipelines.

01

Hemisphere Ambiguity

What to watch: The model drops or misinterprets hemisphere indicators (N/S/E/W, +/-, cardinal suffixes). A coordinate pair like '33.9° 118.4°' without hemisphere context resolves to four possible points on the globe. Guardrail: Require explicit hemisphere fields in the output schema. When hemisphere is missing from input, flag as confidence: low and do not assume a default. Route to human review if the bounding box check fails for all four candidate interpretations.

02

DMS-to-Decimal Rounding Drift

What to watch: Converting degrees-minutes-seconds to decimal degrees accumulates floating-point error, especially with high-precision seconds values. A 0.1-second error in DMS becomes roughly 3 meters of surface displacement. Guardrail: Specify exact precision in the prompt (e.g., '6 decimal places'). Validate round-trip conversion in tests: DMS → decimal → DMS should recover the original seconds value within 0.01 seconds. Log any conversion where the residual exceeds this threshold.

03

Coordinate System Confusion

What to watch: The model receives UTM or MGRS input but treats it as decimal degrees, producing coordinates thousands of kilometers off. UTM easting 500000 looks like a plausible longitude to an unwary parser. Guardrail: Require an explicit coordinate_system field in the input schema. Never auto-detect format without confirmation. Add a pre-check: if latitude > 90 or longitude > 180, reject immediately and request format clarification before normalization.

04

Bounding Box Blind Spots

What to watch: Normalized coordinates pass range checks (-90 to 90, -180 to 180) but fall outside the expected geographic region. A logistics app expecting continental US coordinates silently accepts a valid point in China. Guardrail: Define an expected bounding box per use case (e.g., CONUS, specific country, delivery zone). After normalization, validate coordinates against this box. Flag out-of-bounds results with the distance from the nearest box edge and route for review.

05

Null Island and Zero-Coordinate Defaults

What to watch: When the model cannot parse a coordinate, it may silently output (0, 0)—a real location in the Atlantic off West Africa known as Null Island. Downstream systems treat this as valid data, corrupting analytics and maps. Guardrail: Explicitly instruct the model to return null for unparseable coordinates, never (0, 0). Add a post-processing validator that rejects any result exactly at (0, 0) or (0.0, 0.0) unless the input explicitly describes that location. Log all Null Island hits as extraction failures.

06

Precision Inflation Without Source Justification

What to watch: Input provides '34.1° N, 118.2° W' (one decimal place, roughly 11 km precision). The model normalizes to '34.100000, -118.200000', implying sub-meter accuracy that doesn't exist. Downstream consumers trust the false precision. Guardrail: Include a precision_meters field in the output schema derived from the least precise input component. Round output decimal places to match input significant figures. Flag any normalization that adds more than one decimal place beyond the input precision.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality and correctness of geocoordinate normalization outputs before integrating into production pipelines.

CriterionPass StandardFailure SignalTest Method

Coordinate format conversion

All input formats (DMS, UTM, MGRS, decimal variants) are correctly converted to decimal degrees with specified precision

Output format does not match decimal degrees pattern or precision is incorrect

Parse output with regex for ^-?\d+.\d{PRECISION}, -?\d+.\d{PRECISION}$ and verify against known conversion pairs

Hemisphere interpretation

N/S/E/W indicators correctly map to positive or negative decimal degree values

Southern or western hemisphere coordinates produce positive values or northern/eastern produce negative values

Test with known coordinates: 40°N should yield positive latitude; 40°S should yield negative latitude

Coordinate range validation

Latitude values fall within [-90, 90] and longitude values fall within [-180, 180]

Output contains latitude outside ±90 or longitude outside ±180

Assert min/max bounds on output fields; flag any out-of-range value as failure

Bounding box compliance

Coordinates outside the specified bounding box are flagged with a warning field set to true

Out-of-bounds coordinates pass through without warning or are silently corrected

Supply input known to be outside [BOUNDING_BOX]; verify [OUT_OF_BOUNDS_WARNING] is true

Precision adherence

Output decimal places match the [PRECISION] parameter exactly

Output has more or fewer decimal places than specified

Count decimal places in output string; compare to [PRECISION] value

Null and missing input handling

Empty, null, or unrecognizable input returns null output with [CONFIDENCE] set to 0 and [ERROR_MESSAGE] populated

Invalid input causes hallucinated coordinates or unhandled exception

Pass empty string, null, and 'garbage' as [INPUT]; verify null output and error message presence

Confidence scoring accuracy

Ambiguous inputs (missing hemisphere, single coordinate, conflicting indicators) receive [CONFIDENCE] below threshold

Ambiguous inputs receive high confidence scores

Curate test set of 10 ambiguous inputs; verify all have [CONFIDENCE] < [CONFIDENCE_THRESHOLD]

Source annotation preservation

Output includes [ORIGINAL_INPUT] and [DETECTED_FORMAT] fields matching the supplied input

Source fields are missing, empty, or contain transformed rather than original values

Assert [ORIGINAL_INPUT] equals the raw input string; assert [DETECTED_FORMAT] matches expected format enum

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a small set of test coordinates. Remove strict precision requirements and bounding-box validation. Focus on format detection and conversion correctness first.

code
Normalize the following coordinate to decimal degrees:
[COORDINATE_INPUT]

Return JSON with:
- "latitude": number
- "longitude": number
- "detected_format": string
- "confidence": "high" | "medium" | "low"

Watch for

  • Hemisphere sign errors (S and W should be negative)
  • UTM zone misinterpretation
  • MGRS grid square lookup failures
  • Missing null handling for unparseable inputs
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.