# All Countries by Latitude and Longitude Coordinates

+1
I am currently working on a quiz in which the user enters a set of longitude and latitude co-ordinates into the answer box to fill in a country. For example, typing in 53°N, 2°W would fill in the UK, as these are the co-ordinates of a point in the UK (near Cheadle, Staffordshire). "53n2w" would of course also be accepted as spaces, punctuation and capitalisation are never required on Jetpunk. Only integer co-ordinates would be allowed, so the user would not type in "48.8582°N, 2.2949°E". Countries that contain no integer points can be filled in by typing the letter "Z".

Making this quiz is obviously time-consuming, and I am currently only a small percentage of the way through making it. I am adding type-ins by going down from the 89th parallel north to the 89th parallel south, and I have just finished the 68th parallel north. I expect to be sped up slightly as a result of having read this article, but realistically I will not be spending much time on it and I think it could potentially take around a year.

Here are some examples of lines of Regex I have written for the type-ins on this quiz:

^(80N(100|0?((7(1|2|3|4|5|6|7|8|9))|(8(0|1|2|3|4|5|6|8|9))|(9(0|1|2|3|4|5|6|9))))W)|(70N((0?((6(7|8|9))|(7(0|1|2|3|4|5|6|7|9))|(8(0|2|3|4))|(9(3|4|5|6)))|(1((0(1|2|3|4|5|6|7|8|9))|(1(0|1|2|3|4|5|6|7))|(2(5|7|8))|30|31))))W) (this is all one line!)

^(78N100E)|(68N(((0?(29|3[0-9]|4[56]|[5689][0-9]|7[0-3]|7[5-9]))|1([0-7][0-9]|80))E)|1(7[89]|80)W)

The first of these lines was written before I had read the previously referenced post; the second was written afterwards and I consider it to be much more efficient. UPDATE: After a longer period of time than I had expected, the quiz is now live: CLICK HERE
+1
Level 70
Aug 23, 2019
I have finished the 50th parallel North now. One country so far has only one possible type-in!
+1
Level 70
Aug 26, 2019
I am counting the Great Lakes as inland water of the US and Canada.
+1
Level 70
Sep 1, 2019
I have decided to combine Israel and Palestine so that points in Palestine will count for some country.
+1
Level 70
Sep 9, 2019
I've just finished the 23rd parallel North.
+1
Level 70
Oct 27, 2019
I've done the equator now. Yeah, a bit under a year is looking pretty accurate.
+1
Level 75
May 14, 2020
You can do "[0-9]" for any number between zero and nine...
User Blogs
:: TWM03's Blog
:: This Blog