DJTommek / better-location

Telegram bot for parsing and generating various of location formats.
https://t.me/BetterLocationBot
MIT License
7 stars 2 forks source link

Service Coordinates WGS84 - bad coordinates detection if hyphen is used #137

Closed DJTommek closed 5 months ago

DJTommek commented 5 months ago

Regex is too greedy, see example related to WGS84 service:

Input

This message was sent via Telegram to chat, where bot is member:

Title - Coords - Note
Title1 - 50.087451,14.420671 - some note
Title2 - 50.087451,13.420671 - another note

Expected output

Message from bot related to detected locations with coordinates 50.087451,14.420671 and 50.087451,13.420671.

Real output

Message from bot related to detected locations with coordinates -50.087451,-14.420671 and -50.087451,-13.420671.

Todo

  1. It does not makes sense to keep space between - and actual coordinate, so - 50.087451 must always result in parsing 50.087451. But keep support for N 50.087451 and S 50.087451 resulting in 50.087451 and -50.087451 respectively
  2. It does not make sense to use - after coordinate (with or without space), so 14.420671 - must always result in 14.420671. But keep support for 14.420671W, 14.420671 W resulting in -14.420671 and -14.420671 respectively.