Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 02-03-2011
Luis Cuenca Luis Cuenca is offline
Registrado
 
Registrado: ago 2006
Posts: 9
Poder: 0
Luis Cuenca Va por buen camino
como crear un archivo gpx con delphi 7

Hola a todos, necesito crear un archivo gpx con delphi, estoy usando el componente txmldocument, y tengo el siguiente codigo, pero cuando lo trato de abrir con un programa para archivos gpx me dice que mi archivo no es gpx.

Ojala que me puedan ayudar, llevo varios dias y no encuentro la forma:

Código Delphi [-]
begin
// empty the document
XMLDoc.Active := False;
XMLDoc.XML.Text := '';
XMLDoc.Active := True;
// root
iXml := XmlDoc.DOMDocument;
xmlNode := iXml.appendChild (iXml.createElement ('xml'));
iAttribute := iXml.createAttribute ('version');
iAttribute.nodeValue := '1.0';
xmlNode.attributes.setNamedItem (iAttribute);
//GPX
gpxNode := xmlNode.appendChild(iXml.createElement ('gpx'));
iAttribute := iXml.createAttribute ('xmlns');
iAttribute.nodeValue := 'http.....';
gpxNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('version');
iAttribute.nodeValue := '1.1';
gpxNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('creator');
iAttribute.nodeValue := 'http.....';
gpxNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('xmlns:xsi');
iAttribute.nodeValue := 'http.....';
gpxNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('xsi:schemaLocation');
iAttribute.nodeValue := 'http.....';
gpxNode.attributes.setNamedItem (iAttribute);
mNode := xmlNode.appendChild(iXml.createElement ('metadata'));
 
bNode := mNode.appendChild(iXml.createElement ('bounds'));
 
iAttribute := iXml.createAttribute ('minlat');
iAttribute.nodeValue := '19.38975200';
bNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('minlon');
iAttribute.nodeValue := '-99.17971000';
bNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('maxlat');
iAttribute.nodeValue := '19.39671900';
bNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('maxlon');
iAttribute.nodeValue := '-99.17543500';
bNode.attributes.setNamedItem (iAttribute);
 
trksegNode := xmlNode.appendChild(iXml.createElement ('wpt'));
iAttribute := iXml.createAttribute ('lat');
iAttribute.nodeValue := '19.39671900';
trksegNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('lon');
iAttribute.nodeValue := '-99.17820800';
trksegNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('name');
iAttribute.nodeValue := 'INDIANAPOLIS';
trksegNode.attributes.setNamedItem (iAttribute);
trksegNode := xmlNode.appendChild(iXml.createElement ('wpt'));
iAttribute := iXml.createAttribute ('lat');
iAttribute.nodeValue := '19.38975200';
trksegNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('lon');
iAttribute.nodeValue := '-99.17543500';
trksegNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('name');
iAttribute.nodeValue := 'SUPERAMA';
trksegNode.attributes.setNamedItem (iAttribute);
trksegNode := xmlNode.appendChild(iXml.createElement ('wpt'));
iAttribute := iXml.createAttribute ('lat');
iAttribute.nodeValue := '19.39119400';
trksegNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('lon');
iAttribute.nodeValue := '-99.17971000';
trksegNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('name');
iAttribute.nodeValue := 'CUMULUS1';
trksegNode.attributes.setNamedItem (iAttribute);
 
trkptNode := xmlNode.appendChild (iXml.createElement ('rte'));
trkNode := trkptNode.appendChild (iXml.createElement ('rtept'));
iAttribute := iXml.createAttribute ('lat');
iAttribute.nodeValue := '19.39671900';
trkNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('lon');
iAttribute.nodeValue := '-99.17820800';
trkNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('name');
iAttribute.nodeValue := 'INDIANAPOLIS';
trkNode.attributes.setNamedItem (iAttribute);
trkNode := trkptNode.appendChild (iXml.createElement ('rtept'));
iAttribute := iXml.createAttribute ('lat');
iAttribute.nodeValue := '19.38975200';
trkNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('lon');
iAttribute.nodeValue := '-99.17543500';
trkNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('name');
iAttribute.nodeValue := 'SUPERAMA';
trkNode.attributes.setNamedItem (iAttribute);
trkNode := trkptNode.appendChild (iXml.createElement ('rtept'));
iAttribute := iXml.createAttribute ('lat');
iAttribute.nodeValue := '19.39119400';
trkNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('lon');
iAttribute.nodeValue := '-99.17971000';
trkNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('name');
iAttribute.nodeValue := 'CUMULUS1';
trkNode.attributes.setNamedItem (iAttribute);
trkNode := trkptNode.appendChild (iXml.createElement ('rtept'));
iAttribute := iXml.createAttribute ('lat');
iAttribute.nodeValue := '19.39671900';
trkNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('lon');
iAttribute.nodeValue := '-99.17820800';
trkNode.attributes.setNamedItem (iAttribute);
iAttribute := iXml.createAttribute ('name');
iAttribute.nodeValue := 'INDIANAPOLIS';
trkNode.attributes.setNamedItem (iAttribute);
// show XML in memo
Memo1.Lines.Text := FormatXMLData (XMLDoc.XML.Text);
XMLDoc.SaveToFile('C:\Users\j\Desktop\borrar\codigo2.gpx');
 
end;

Última edición por Casimiro Notevi fecha: 02-03-2011 a las 01:06:05. Razón: Poner etiquetas [delphi] el código [/delphi]
Responder Con Cita
 



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
como crear archivo .xml para cfd richy08 Varios 8 17-12-2010 00:09:05
Error al crear archivo de excel con delphi lduron Varios 2 26-08-2010 16:02:29
Crear archivo imborrable con Delphi d3an Lazarus, FreePascal, Kylix, etc. 1 04-02-2010 15:05:10
como crear un archivo en php? gabrielflowers PHP 5 27-03-2008 22:12:18
Cómo crear archivo hlp.... oracle Varios 4 01-08-2005 14:19:12


La franja horaria es GMT +2. Ahora son las 23:47:35.


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