Package com.yahoo.geo
Class DegreesParser
- java.lang.Object
-
- com.yahoo.geo.DegreesParser
-
public class DegreesParser extends Object
Utility for parsing geographical coordinates- Author:
- arnej27959
-
-
Constructor Summary
Constructors Constructor Description DegreesParser(String latandlong)
Parse the given string.
-
-
-
Constructor Detail
-
DegreesParser
public DegreesParser(String latandlong) throws IllegalArgumentException
Parse the given string. The string must contain both a latitude and a longitude, separated by a semicolon, in any order. A latitude must contain "N" or "S" and a number signifying degrees north or south. A longitude must contain "E" or "W" and a number signifying degrees east or west. No signs or spaces are allowed.
Fractional degrees are recommended as the main input format, but degrees plus fractional minutes may be used for testing. You can use the degree sign (U+00B0 as seen in unicode at http://www.unicode.org/charts/PDF/U0080.pdf) to separate degrees from minutes, put the direction (NSEW) between as a separator, or use a small letter 'o' as a replacement for the degrees sign.
Some valid input formats:
"N37.416383;W122.024683" → Sunnyvale
"37N24.983;122W01.481" → same
"N37°24.983;W122°01.481" → same
"N63.418417;E10.433033" → Trondheim
"N63o25.105;E10o25.982" → same
"E10o25.982;N63o25.105" → same
"N63.418417;E10.433033" → same
"63N25.105;10E25.982" → same- Parameters:
latandlong
- Latitude and longitude separated by semicolon.- Throws:
IllegalArgumentException
-
-