question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lat / Long matches incorrectly

See original GitHub issue
$ poetry run pywhat acb6d73d95a10d30aef9894603e90963   

Matched on: e90963
Name: Latitude & Longitude Coordinates
Link:  https://www.google.com/maps/place/e90963

Bug found in #196

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Saacketcommented, Oct 17, 2021

plz explain

0reactions
nodtem66commented, Nov 3, 2021

I propose this new one: https://regex101.com/r/WrINyr/1

The old RegEx consists of three patterns:

  1. Full expression with symbols and prefix N/W/S/E , e.g. N 32° 53.733 W 096° 48.358 (?:(?:N|W|S|E)\\s?\\d+\\s?\\u00B0?\\s?\\d+\\.?\\d*\\s?\\'?\\s?\\d*\\.?\\,?\\d*?\"?\\s?){1,2}
  2. Full expression with symbols and subfix N/W/S/E, e.g. 13°55’24.3"N 101°20’30.1"E (?:\\d+\\s?\\u00B0\\s?\\d+\\s?\\'\\s?\\d+\\.?\\,?\\d{0,}?\"\\s?(?:N|W|S|E)\\s?){1,2}
  3. Two decimal numbers without symbols and prefixs, e.g. 52.6169586, -1.9779857 (?:[-+]?(?:[0-8]?\\d+\\.\\d{4,}|90(?:\\.0+)?),\\s*[-+]?(?:180(?:\\.0+)?|(?:(?:1[0-7]\\d)|(?:[1-9]?\\d))(?:\\.\\d+)?)) https://github.com/bee-san/pyWhat/blob/6162aceac5b9b68e2bd8f8af56cb94f2eab4a69c/pywhat/Data/regex.json#L1480

The first pattern slightly differs from the second pattern in the symbol matchings

  • \\u00B0? and \\u00B0
  • \\'? and \\'
  • \"? and \" This causes the RegEx matching of e26, e90963, and so on.

I’ve observed that there is nothing like N 52.6169586, W -1.9779857; only N 32° 53.733 W 096° 48.358, and 52.6169586, -1.9779857 are valid.

Then these symbol matching should’ve been changed to the strict matching of \\u00B0, \\', and \" or the flexible matching of \\u00B0, \\'?, and \"?.

If it looks fine, I’ll make a patch. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Regular expression for matching latitude/longitude coordinates?
I expected this to match a double, a comma, perhaps some space, and another double, but it doesn't seem to work. Specifically it...
Read more >
Latitude Longitude Coordinates not matching - Autodesk Forums
Solved: Hello, I am trying to get my latitude and longitude coordinates to match... Now attached are my abiement settings, and drawing.
Read more >
X and Y coordinates display at incorrect locations in ArcGIS Pro
The following describe the possible causes: The geographic coordinate system of the map extent does not match that of the output feature class....
Read more >
Lat, long values extracted in QGIS do not match/overlay with ...
I have been using QGIS to extract lat and long vertices from a number of shapefiles. It worked great but for one file....
Read more >
Why GPS Coordinates Look Wrong on Maps of China
If so then you may have noticed that satellite images do not match up with any of the geographic features on the map,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found