Point Validator

Sanitize and validate a coordinate point

Description

This page simply validates a coordinate Point - a double composed of a decimal latitude and decimal longitude. I built it to test my sanitizing & validation code. Following the same rules as for latitude and longitude, I want to:

  • Trim whitespace; Strip slashes; Convert html.
  • Remove degree (°) signs.
  • Truncate (not round) to 6 digits past the decimal.
  • Trim leading zeros: "-005.5" --> "-5.5".
  • Begin with zero: ".6" --> "0.6".
  • Correct negative zero: "-0" --> "0".
  • Accept latitudes from -90 to 90 and longitudes from -180 to 180.

Inputs

Outputs