Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > PHP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 25-09-2008
Avatar de richy08
richy08 richy08 is offline
Miembro
 
Registrado: may 2007
Ubicación: Bucerias, Nayarit Mexico
Posts: 529
Poder: 17
richy08 Va por buen camino
generar .kml desde php

buenas tardes compañeros les cuento estoy tratabdo de generar archivos .kml dinamicamente con php y mysql el problema es que no entiendo por que no me imprime el arreglo o no se como especificarle que me abra el google earth y me tome las posiciones el codigo que utilizo es ele siguiente

Código PHP:
<?php
require('conexion.php');
// Opens a connection to a MySQL server.
$connection mysql_connect (localhostrootroot);
if (!
$connection
{
die(
'Not connected : ' mysql_error());
}

// Sets the active MySQL database.
$db_selected mysql_select_db(earth$connection);
if (!
$db_selected
{
die (
'Can\'t use db : ' mysql_error());
}

// Selects all the rows in the markers table.
$query 'SELECT * FROM marcadores WHERE 1';
$result mysql_query($query);
if (!
$result
{
die(
'Invalid query: ' mysql_error());
}

// Creates an array of strings to hold the lines of the KML file.
$kml = array('<?xml version="1.0" encoding="UTF-8"?>');
$kml[] = '<kml xmlns="http://earth.google.com/kml/2.1">';
$kml[] = ' <Document>';
$kml[] = ' <Style id="restsaurantStyle">';
$kml[] = ' <IconStyle id="restuarantIcon">';
$kml[] = ' <Icon>';
$kml[] = ' <href>http://maps.google.com/mapfiles/kml/pal2/icon63.png</href>';
$kml[] = ' </Icon>';
$kml[] = ' </IconStyle>';
$kml[] = ' </Style>';
$kml[] = ' <Style id="barStyle">';
$kml[] = ' <IconStyle id="barIcon">';
$kml[] = ' <Icon>';
$kml[] = ' <href>http://maps.google.com/mapfiles/kml/pal2/icon27.png</href>';
$kml[] = ' </Icon>';
$kml[] = ' </IconStyle>';
$kml[] = ' </Style>';

// Iterates through the rows, printing a node for each row.
while (
$row = @mysql_fetch_assoc($result)) 
{
$kml[] = ' <Placemark id="placemark' $row['id'] . '">';
$kml[] = ' <name>' htmlentities($row['name']) . '</name>';
$kml[] = ' <description>' htmlentities($row['address']) . '</description>';
$kml[] = ' <styleUrl>#' . ($row['type']) .'Style</styleUrl>';
$kml[] = ' <Point>';
$kml[] = ' <coordinates>' $row['lng'] . ',' $row['lat'] . '</coordinates>';
$kml[] = ' </Point>';
$kml[] = ' </Placemark>'

// End XML file
$kml[] = ' </Document>';
$kml[] = '</kml>';
$kmlOutput join("\n"$kml);
header('Content-type: application/vnd.google-earth.kml+xml');
echo 
$kmlOutput;[/left]
?>
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Generar XML desde tclientdataset alopete Varios 2 15-05-2008 10:29:51
Como Generar Un Archivo Txt Desde Delphi AdIIX Varios 10 27-09-2007 20:48:04
Generar archivo delimitado desde tabla SQL delphisenda Varios 4 29-06-2007 15:50:16
Generar una DB en Firebird desde Delphi RONPABLO Conexión con bases de datos 1 22-10-2004 09:58:28
Generar AVI desde otro AVI .... ingel Gráficos 16 03-06-2004 19:51:13


La franja horaria es GMT +2. Ahora son las 04:06:12.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi