Mostrando entradas con la etiqueta kml. Mostrar todas las entradas
Mostrando entradas con la etiqueta kml. Mostrar todas las entradas

28 de febrero de 2010

trivial KML point .KML file for GoogleEarth with Perl

Hay librerias en CPAN para crear archivos KML y XML, pero al final he hecho uno propio y muy sencillito, trivial ...

n.d.a: Lo subo en imagen ya que no hay manera que pille los caracteres especiales del código

Crea un ficehro .KML que se puede abrir con googleEarth y funciona!!.

Ref.:
KML: Guía del usuario de Google Earth


Update: He usado la utilidad parse HTML de Blogcrowds para hacer visible el código a HTML:

#!/usr/bin/perl
#####################################################
# very simple .KML creator
# by pp:)2010
# for www.misnotaslinux.blogspto.com
#####################################################

use strict;

print "ppTrivialPerlScript that make .KML geo.point for google earthnn";

print "Nombre del punto: ";
my $nombre = <STDIN>;
chop $nombre;

my $filekml = $nombre."-point";
$filekml =~ s/ /_/g;

print "nLongitud: ";
my $longitud = <STDIN>;
chop $longitud;

print "nLatitud: ";
my $latitud = <STDIN>;
chop $latitud;

print "n";

#kml maker

open ( KML, ">$filekml.kml" );

print KML "<kml xmlns="http://earth.google.com/kml/2.0">n";
print KML "<Folder>n";
print KML "<Placemark>n";
print KML "<description>nombre: $nombre<br/>longitud: $longitud<br/>latitud: $latitud<br/></description>n";
print KML "<name>$nombre</name>n";
print KML "<Point>n";
print KML "<altitudeMode>clampToGround</altitudeMode>n";
print KML "<coordinates>$longitud,$latitud</coordinates>n";
print KML "</Point>n";
print KML "</Placemark>n";
print KML "</Folder>n";
print KML "</kml>n";

close (KML);