Geo-Google-StaticMaps-V2

 view release on metacpan or  search on metacpan

lib/Geo/Google/StaticMaps/V2.pm  view on Meta::CPAN

                                           height   => 480,
                                           sensor   => 0,
                                           scale    => 1,
                                           format   => "png8",
                                           type     => "roadmap",
                                           protocol => "http",
                                           server   => "maps.googleapis.com",
                                           script   => "/maps/api/staticmap",
                                          );

Any property can be specified on construction but all have sane defaults and are not required to be set.

=head2 marker

Creates a L<Geo::Google::StaticMaps::V2::Markers> object and adds the object to the internal Markers array.

  $map->marker(location=>"7140 Main Street, Clifton, Virginia 20124");
  $map->marker(location=>{lat=>38.780676,lon=>-77.387105});
  $map->marker(location=>[38.780676,-77.387105]);
  $map->marker(location=>"38.780676,-77.387105");

markers (optional) define one or more markers to attach to the image at specified locations. Multiple markers may be placed within the same markers parameter as long as they exhibit the same style; you may add additional markers of differing styles b...

Examples

  my $marker1=$map->marker(location=>{lat=>38.780676,lon=>-77.387105}); #isa L<Geo::Google::StaticMaps::V2::Markers>
  $marker1->addLocation([38.780513,-77.387128]);                        #second point shares style with first point

  my $marker2=$map->marker(locations=>[
                                       {lat=>38.780596,lon=>-77.386837},
                                       [38.780346,-77.386923]
                                      ]);                               #third and forth points with different style
  $marker2->size("tiny");                                               #third and forth points are now tiny
  $marker1->color("blue");                                              #first and second point are now blue

=cut

sub marker {
  my $self=shift;
  my $obj=Geo::Google::StaticMaps::V2::Markers->new(@_);
  push @{$self->_markers}, $obj;
  return $obj;
}

#head2 _markers
#
#Returns an array reference with the current list of marker objects.
#
#cut

sub _markers {
  my $self=shift;
  $self->{"_markers"}=[] unless ref($self->{"_markers"}) eq "ARRAY";
  return $self->{"_markers"};
}

=head2 path

Creates a L<Geo::Google::StaticMaps::V2::Path> object and adds the object to the internal Paths array.

path (optional) defines a single path of two or more connected points to overlay on the image at specified locations. Note that if you supply a path for a map, you do not need to specify the (normally required) center and zoom parameters.

=cut

sub path {
  my $self=shift;
  my $obj=Geo::Google::StaticMaps::V2::Path->new(@_);
  push @{$self->_paths}, $obj;
  return $obj;
}

#head2 _paths
#
#Returns an array reference with the current list of path objects.
#
#cut

sub _paths {
  my $self=shift;
  $self->{"_paths"}=[] unless ref($self->{"_paths"}) eq "ARRAY";
  return $self->{"_paths"};
}

=head2 visible

Creates a L<Geo::Google::StaticMaps::V2::Visible> object and adds the object to the internal Visibles array.

visible (optional) specifies one or more locations that should remain visible on the map, though no markers or other indicators will be displayed. Use this parameter to ensure that certain features or map locations are shown on the static map.

=cut

sub visible {
  my $self=shift;
  my $obj=Geo::Google::StaticMaps::V2::Visible->new(@_);
  push @{$self->_visibles}, $obj;
  return $obj;
}

#head2 _visibles
#
#Returns an array reference with the current list of visible objects.
#
##cut

sub _visibles {
  my $self=shift;
  $self->{"_visibles"}=[] unless ref($self->{"_visibles"}) eq "ARRAY";
  return $self->{"_visibles"};
}

=head1 PROPERTIES

=head2 center

center (required if markers not present) defines the center of the map, equidistant from all edges of the map. This parameter takes a location as either a comma-separated {latitude,longitude} pair (e.g. "40.714728,-73.998672") or a string address (e....

=cut

sub center {
  my $self=shift;
  $self->{"center"}=shift if @_;



( run in 1.619 second using v1.01-cache-2.11-cpan-39bf76dae61 )