Hatena::Groupmobilehacker

tokuhiromの日記 RSSフィード

 | 

2008-01-11

G::C::Format::Dms のパッチ 16:41 G::C::Format::Dms のパッチ - tokuhiromの日記 を含むブックマーク はてなブックマーク - G::C::Format::Dms のパッチ - tokuhiromの日記 G::C::Format::Dms のパッチ - tokuhiromの日記 のブックマークコメント

1ケタのときもあるお ><

id:yappo さん、これあてていいす?

=== lib/Geo/Coordinates/Converter/Format/Dms.pm
==================================================================
--- lib/Geo/Coordinates/Converter/Format/Dms.pm (revision 4652)
+++ lib/Geo/Coordinates/Converter/Format/Dms.pm (local)
@@ -13,8 +13,8 @@
 sub detect {
     my($self, $point) = @_;
 
-    return unless $point->lat =~ /^[\-\+NS]?\d{1,2}\.\d\d\.\d\d(?:\.\d+)$/i;
-    return unless $point->lng =~ /^[\-\+EW]?\d{1,3}\.\d\d\.\d\d(?:\.\d+)$/i;
+    return unless $point->lat =~ /^[\-\+NS]?\d{1,2}\.\d\d?\.\d\d?(?:\.\d+)$/i;
+    return unless $point->lng =~ /^[\-\+EW]?\d{1,3}\.\d\d?\.\d\d?(?:\.\d+)$/i;
     return $self->name;
 }
 
=== t/02_format.t
==================================================================
--- t/02_format.t       (revision 4652)
+++ t/02_format.t       (local)
@@ -136,3 +136,10 @@
 --- lat: -35.573394
 --- lng: 139.619272
 --- format: degree
+
+===
+--- point
+lat: s35.4.4.218
+lng: e139.7.9.379
+--- lat: -35.04.04.218
+--- lng: 139.07.09.379


 |