[OSGeo-Discuss] parsing coordinates

Pere Roca Ristol peroc79 at gmail.com
Fri Jun 26 03:09:19 PDT 2009



  hi Agustin,
  thanks for the info, but what I was looking for is an on-line tool or
script to run on server-side.
  A project's colleague (Dominik Mikiewicz) has developed a tool; it runs on
ASPX but the source code is in C# and soon will be migrated to JAVA. 

  if someone is interested can check
http://forest.miiz.waw.pl/gis/coordinateconverter/default.aspx
  Any feedback and/or suggestions are wellcome.

  Below are some comments from the author (about 29 april, maybe now
outdated)

   "At the moment it converts only 4 coordinate notation patterns (currently
English only, sorry) but I tried to enable it to convert most of the
flavours of given notation. If you find anything that is supposed to be
converted but either yields an error in an application (serious problem as
the parser recognizes pattern but can't parse it) or gives a 'Unrecognized
pattern' message, please note the coordinate string you were trying to parse
and kindly send it to me.

   Ideally, if I have enough spare time, I will add a custom pattern builder
and a batch converter for the csv / txt files. This may take some time
though. Anyway, just to get to the point:
 
Recognized coordinate notations are:
1. Variations of DD(.|,)DDD (useful if hemisphere indicator is to be
removed)
2. Variations of DD(°|d)MM.MMM('|m)
3. Variation of DD(°|d)MM(ʹ|m)SS.SSS(ʺ|s)
4. Variation of DD:MM:SS.SSS
 
   Some other comments that may be useful:
1. Characters in brackets mean that the converter recognizes all of the
listed characters. Furthermore they can be mixed, ie: 12°25m, 12d25',
12D25m, or omitted when at the end, ie:  12°12, 12°, 12, etc.

2. Converter recognizes patterns even if they are not written in the full so
quite flexible notations are allowed, ie: DD, DD:, DD:MM, DD:MM:, DD:MM:SS,
DD:MM:SS., DD:MM:SS.SSS, etc

3. In adition to the coordinate pattern each coordinate may have either
(+|-|N|n|S|s|W|w|E|e) in the front or (N|n|S|s|W|w|E|e) at the end; in a
case there is no chemisphere indicator the parser assumes the coordinate is
positive; in a specific case of the DD(°|d)MM(ʹ|m)SS.SSS(ʺ|s) notation, when
there is "s" used to mark seconds the coverter will assume the coordinate is
negative if the hemisphere indicator is not given explicitly - by using
(+|-|N|n|S|s|W|w|E|e) in front or (N|n|S|s|W|w|E|e) at the end

4. Any amouont of the white space characters may be used between each part
of the coordinate except between a number and it's decimal part. So <<N   
12D   30   '>> or <<   -  123  °  30   '   50  ''  >> is allowed but <<12  , 
30>> will yield an "unrecognized pattern' message; as demonstrated in this
example any amount of whitespace characters may also be at the beginning or
at the end of the string.

   Pere  

adiez wrote:
> 
> There is a new extension [1] for gvSIG able to do that [2].
> [1] http://www.gvsig.gva.es/index.php?id=2187&L=0
> [2] http://mmedia.uv.es/display?c=adiez&name=normalizar.mov
> 
> 
> On Apr 20, 2009, at 12:04 PM, pere roca ristol wrote:
> 
>>
>> hi all,
>>
>> I'm developing a webapplication that let's user upload their point  
>> data and play with it.
>> It currently works with lat/long in a CSV with this format (eg:  
>> 0.44, -79.9) but we find users with some of these also valid and  
>> acceptable ways to write geographic coordinates:
>> 40:26:46N,79:56:55W
>> 40:26:46.302N 79:56:55.903W
>> 40°26'21"N 79°58'36"W
>> 40d 26' 21" N 79d 58' 36" W
>> 40.446195N 79.948862W
>> 40.446195, -79.948862
>> 40° 26.7717, -79° 56.93172
>>
>> I'm aware that parsing and interpreting free-text coordinate  
>> descriptions is quite complex, maybe someone knows a script (or a  
>> remote service) that does a similar job?
>>
>> It would be very helpful.
>> Thanks!
>>
>> Pere
>> _______________________________________________
>> Discuss mailing list
>> Discuss at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/discuss
> 
> 
> _______________________________________________
> Discuss mailing list
> Discuss at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/discuss
> 
> 

-- 
View this message in context: http://n2.nabble.com/parsing-coordinates-tp2662782p3160702.html
Sent from the OSGeo Discuss mailing list archive at Nabble.com.




More information about the Discuss mailing list