|
Posted by Chris W on September 3, 2006, 5:19 pm
Please log in for more thread options
I am working on a web site that will require the entry of latitude
longitude coordinates. As you probably know there area lot of
different ways to format latitude and longitude. I have done my best to
make my code work no mater what format you use. If you have some time
and would like to try it, I want to know if anyone can break it. If you
do, please send me the data you used to break it, so I can figure out
why it broke and fix it. Below is the URL for the test. The web site
it is currently on is not the web site it is for, that is just where I
am doing the testing until I get a server set up for the new site.
http://www.thewishzone.com/LatLonTest.php
P.S. If anyone wants a copy of the code I wrote to do this, let me know
and I will email it to you.
--
Chris W
KE5GIX
Gift Giving Made Easy
Get the gifts you want &
give the gifts they want
One stop wish list for any gift,
from anywhere, for any occasion!
http://thewishzone.com
|
|
Posted by rcmcc@earthlink.net on September 3, 2006, 10:36 pm
Please log in for more thread options
Chris W wrote:
>entry of latitude and longitude coordinates.
> a lot of different ways to format latitude and longitude.
> I have done my best to make my code work
> no matter what format you use.
Hi, Chris,
In a few tests it looks like you have done a good job.
I will take a few more whacks at breaking the scheme,
but I believe any _reasonable_ input should work.
The program can always say,
"Huh? Please try again."
I tackled this issue in the last century ago using Fortran.
I'm sure that you are not using a language so clumsy
in handling input, so I doubt my solution will help you.
My results are used in my geodesic calculation
DOS command line program.GCGC.
I/O take up most of the program, in spite of using
the best geodesic calculation algorithms available.
I spent/spend a lot of time trying to break my input.
Source and DOS executables are at my web site below.
I would be interested in peeking at your code
for my education.
Cheers, 73,
Ron McC.
W2IOL
w2iol@arrl.net
Ronald C. McConnell, PhD
WGS-84: N 40=BA 46' 57.9" +/-0.1"
W 74=BA 41' 21.3" +/-0.1"
FN20ps.77GU96 +/-
V +5058 H +1504
<http://home.earthlink.net/~rcmcc>
|
|
Posted by Paul Cooper on September 4, 2006, 3:52 am
Please log in for more thread options
>I am working on a web site that will require the entry of latitude
>longitude coordinates. As you probably know there area lot of
>different ways to format latitude and longitude. I have done my best to
>make my code work no mater what format you use. If you have some time
>and would like to try it, I want to know if anyone can break it. If you
>do, please send me the data you used to break it, so I can figure out
>why it broke and fix it. Below is the URL for the test. The web site
>it is currently on is not the web site it is for, that is just where I
>am doing the testing until I get a server set up for the new site.
>
>http://www.thewishzone.com/LatLonTest.php
>
>P.S. If anyone wants a copy of the code I wrote to do this, let me know
>and I will email it to you.
Well, you need some range checking. It accepts latitudes outside the
range +/- 90 and longitudes outside the range +/- 360.
Latitudes outside this range are definitely wrong; it is less critical
for longitudes.
It also does not accept lat/long strings as defined in ISO 6709:1983 :
i.e.
Latitude
Degrees and decimal degrees:
DD.DD
Degrees, minutes and decimal minutes:
DDMM.MMM
Degrees, minutes, seconds and decimal seconds:
DDMMSS.SS
Leading Zeroes shal be inserted for degre, minute or second values
less than 10.
Longitude
Degrees and decimal degrees:
DDD.DD
Degrees, minutes and decimal minutes:
DDDMM.MMM
Degrees, minutes, seconds and decimal seconds:
DDDMMSS.SS
Leading zeros shall be inserted for degree value less than 100, and
zeros shall be embedded in proper positions when minutes or seconds
are less than 10.
Paul
|
|
Posted by Jacquelin Hardy on September 4, 2006, 9:47 am
Please log in for more thread options Chris W a écrit :
> I am working on a web site that will require the entry of latitude
> longitude coordinates. As you probably know there area lot of
> different ways to format latitude and longitude. I have done my best to
> make my code work no mater what format you use. If you have some time
> and would like to try it, I want to know if anyone can break it. If you
> do, please send me the data you used to break it, so I can figure out
> why it broke and fix it. Below is the URL for the test. The web site
> it is currently on is not the web site it is for, that is just where I
> am doing the testing until I get a server set up for the new site.
>
> http://www.thewishzone.com/LatLonTest.php
>
> P.S. If anyone wants a copy of the code I wrote to do this, let me know
> and I will email it to you.
>
>
Hi Chris,
Instead of trying to predict all user's possibilities to enter Lat &
Long, why don't you choose yourself the most common possibilities and
let the user choose one of these.
Paul came up with ISO 6709:1983. There is also S-57 ENC notation where
lat & long are multiplied by a million.
And you have some GPS where you have DDDMM.mmm. There is no end to this.
So be the one that decides !
Like : DD.dddddd, DD MM.mmmmm, DD MM SS.ssss
Then you just have to check the limit ranges, ie. +-90 for lat, +- 180
for Long.
HTH
Jacquelin Hardy
|
|
Posted by Chris W on September 4, 2006, 4:02 pm
Please log in for more thread options Jacquelin Hardy wrote:
> Hi Chris,
>
> Instead of trying to predict all user's possibilities to enter Lat &
> Long, why don't you choose yourself the most common possibilities and
> let the user choose one of these.
The only problem with that is users don't tend to bother reading
directions, so I want to allow for the most common possibilities.
> Paul came up with ISO 6709:1983. There is also S-57 ENC notation where
> lat & long are multiplied by a million.
> And you have some GPS where you have DDDMM.mmm. There is no end to this.
I know it is going to be impossible to allow for every possibility as
some will conflict. However I think I can get all the common formats to
work. I made a change so the Lat of DDMM.MMMM and DDMMSS.SS will work.
DD.DDDDDD worked before and still will. Lon is simmilar DDDMM.MMM and
DDDMMSS.SSS both work. The number of digits after the decimal point
can be anything bigger than 1. But there does have to be at least 1.
>
> So be the one that decides !
>
> Like : DD.dddddd, DD MM.mmmmm, DD MM SS.ssss
These already work.
>
> Then you just have to check the limit ranges, ie. +-90 for lat, +- 180
> for Long.
I didn't think about checking out of range data but it is done now.
Thanks for all the input. I will end up having probably 3 examples of
how to enter the data but, I still want it to be as robust as reasonably
possible. The way it is now as long as there is something other than a
decimal point between the degrees, minutes and seconds, it should work.
You can even have it like this 35Degrees 22Minutes 56.35Seconds North.
The code looks for North or South, If it finds one of them, it sets
the direction to either negative or positive, replaces all letters with
spaces and then makes sure all double spaces are replaced with a single
space. In the case above if you tried to abbreviate north and south as
N or S, it would fail because there both an N and an S in the other
text, so what it would do is not predictable. Anyway I think it is
working pretty good now, unless someone comes up with something that
isn't too odd ball, that I haven't thought of, I think it is done.
--
Chris W
KE5GIX
Gift Giving Made Easy
Get the gifts you want &
give the gifts they want
One stop wish list for any gift,
from anywhere, for any occasion!
http://thewishzone.com
|
| Similar Threads | Posted | | Longitude Latitude database | November 13, 2006, 3:21 pm |
| WTM83 and Latitude/Longitude | May 29, 2007, 2:56 pm |
| getting zone codes from longitude and latitude | May 18, 2005, 12:10 pm |
| MySQL Longitude & Latitude calculations | August 2, 2005, 6:55 pm |
| Time Zone by latitude and longitude | July 14, 2006, 5:20 am |
| Help me to convert X,Y to Latitude Longitude on mouse click. | May 5, 2006, 3:30 pm |
| How to map StreetPilot III latitude/longitude on Google maps? | August 19, 2007, 1:35 am |
| Longitude Latitude WGS84 to State Plane Coordinates | December 16, 2006, 7:04 pm |
| Converting Lambert Projection Clarke1866 Coords to Latitude / Longitude | January 28, 2006, 3:55 am |
| Convert a shapefile with a French projection system to the common EPSG:4326 projection WGS84 (latitude, longitude) | May 31, 2008, 8:25 am |
|