OHTSUKA Ko-hei > Geo-Formatter > Geo::Formatter

Download:
Geo-Formatter-0.0.1.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.0.1   Source  

NAME ^

Geo::Formatter - Encode / decode latitude & longitude in degree to / from other format

SYNOPSIS ^

  use Geo::Formatter;
  # Export 3 functions, latlng2format, format2latlng, and alias_format.
  
  # Encode:
  
  # Degree format with 6 digits under the decimal point.
  my ($lat,$lng) = latlng2format("degree",35,135); 
  # 35.000000, 135.000000
  
  # Signed degree format with 4 digits under the decimal point.
  my ($lat,$lng) = latlng2format("degree",35,135,{sign => 1,under_decimal => 4}); 
  # +35.0000, +135.0000
  
  # Dms format with 3 digits under the decimal point in second part.
  my ($lat,$lng) = latlng2format("dms",35,135); 
  # 35.0.0.000, 135.0.0.000
  
  # Dms format with zerofill and 0 digits under the decimal point in second part.
  my ($lat,$lng) = latlng2format("dms",35,135,{zerofill => 1,under_decimal => 0}); 
  # 35.00.00, 135.00.00
  
  # Signed dms format with "/" as devider.
  my ($lat,$lng) = latlng2format("dms",35,135,{devider => "/",sign => 1}); 
  # +35/0/0.000, +135/0/0.000
  
  # Decode:
  
  # Dms format.
  my ($lat,$lng) = format2latlng("dms","35.0.0.000","135.0.0.000"); 
  # 35, 135
  
  # Dms format with "/" as devider.
  my ($lat,$lng) = format2latlng("dms","+35/00/00.000","+135/00/00.000",{devider => "/"}); 
  # 35, 135
  
  # Alias:
  # You can alias any format to other name with default option
  
  alias_format("degree8","degree",{encode =>{under_decimal => 8}});
  my ($lat,$lng) = latlng2format("degree8",35,135); 
  # 35.00000000, 135.00000000
  
  alias_format("dms2","dms",{encode =>{devider=>"/",zerofill=>1},decode =>{devider=>"/"}});
  my ($lat,$lng) = latlng2format("dms2",35,135); 
  # 35/00/00.000, 135/00/00.000
  my ($lat,$lng) = format2latlng("dms2","35/00/00.000","135/00/00.000"); 
  # 35, 135

DESCRIPTION ^

This module provides framework of encoding/decoding latlong in degree to/from other format. Default module provide only degree and dms formats, but you can extend other formats with Geo::Formatter::Format::XXX type modules.

EXPORT ^

3 functions are exported.

CLASS METHOD ^

DEPENDENCIES ^

Exporter Class::Inspector UNIVERSAL::require

AUTHOR ^

OHTSUKA Ko-hei <nene@kokogiko.net>

LICENCE AND COPYRIGHT ^

Copyright (c) 2008, OHTSUKA Ko-hei <nene@kokogiko.net>.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY ^

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

syntax highlighting: