Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Sa Jun 08, 2024 18:06

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 10 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: google earth kml file format
BeitragVerfasst: Mo Mai 01, 2006 21:27 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
on taking a look at the google earth kml file format, things are not as easy as they looked first.

a kml is basicly a xml document. (also there are .kmz files which are just kml files inside a .zip file)

a tutorial on the file format can be found here: http://www.keyhole.com/kml/kml_tut.html#polygons

as there are things called polygons i expted to be able to use

Code:
  1. glBegin(GL_POLYGON);
  2.  
  3. glVertex3f(x,y,z);
  4. .....
  5.  
  6. glEnd;


but that did not give the correct result. (bug i could just have misplaced the camera)

but looking at the coords i cannot detect a pentagon like shape inside it, unles is deeply hidden in the numbers behind the .

any ideas are welkom. it sure would be nice to be able to use google sketchup http://sketchup.google.com to design 3d models for use in your delphi opengl applications.

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Mai 02, 2006 12:08 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 17, 2002 12:07
Beiträge: 976
Wohnort: Tübingen
Hmm it seems that the coordinates in the keyhole-tutorial differ from the second position after the dot. The values given in the tutorial seem like they are "earth coordinates". Have you already tried to delete the numbers before and scaled it to "bigger" ones? For example:
Code:
  1. -77.05788457660967 -> -7.88457660967

_________________
"Du musst ein Schwein sein in dieser Welt, sangen die Prinzen, das ist so 1.0. Du musst auf YouTube zeigen, dass dir dein Schweinsein gefällt, das ist leuchtendes, echtes Web 2.0."
- Hal Faber

Meine Homepage: http://laboda.delphigl.com


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Mai 02, 2006 15:32 
Offline
DGL Member

Registriert: Fr Dez 19, 2003 14:27
Beiträge: 107
Wohnort: Indianapolis, USA
Seems to work for me:
Code:
  1.     public partial class Form1 : Form
  2.     {
  3.         private Context m_Context;
  4.  
  5.         public Form1()
  6.         {
  7.             InitializeComponent();
  8.             SetStyle(ControlStyles.AllPaintingInWmPaint, true);
  9.             SetStyle(ControlStyles.UserPaint, true);
  10.             SetStyle(ControlStyles.ResizeRedraw, true);
  11.  
  12.             m_Context = new Context(this, 32, 16, 0);
  13.         }
  14.  
  15.         protected override void OnPaintBackground(PaintEventArgs e)
  16.         {            
  17.         }
  18.  
  19.         protected override void OnPaint(PaintEventArgs e)
  20.         {
  21.             gl.Clear(gl.COLOR_BUFFER_BIT);
  22.             gl.Viewport(0, 0, ClientSize.Width, ClientSize.Height);
  23.             gl.MatrixMode(gl.PROJECTION);
  24.             gl.LoadIdentity();
  25.             glu.Ortho2D(-77.050, -77.06, 38.875, 38.865);
  26.             gl.MatrixMode(gl.MODELVIEW);
  27.             gl.LoadIdentity();
  28.  
  29.             gl.Color3f(1.0f, 1.0f, 1.0f);
  30.             gl.Begin(gl.POLYGON);
  31.             gl.Vertex2d(-77.05788457660967d, 38.87253259892824d);
  32.             gl.Vertex2d(-77.05465973756702d, 38.87291016281703d);
  33.             gl.Vertex2d(-77.05315536854791d, 38.87053267794386d);
  34.             gl.Vertex2d(-77.05552622493516d, 38.868757801256d);
  35.             gl.Vertex2d(-77.05844056290393d, 38.86996206506943d);
  36.             gl.Vertex2d(-77.05788457660967d, 38.87253259892824d);
  37.             gl.End();
  38.  
  39.             m_Context.SwapBuffers();
  40.         }
  41.     }


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Mai 02, 2006 20:50 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Aug 17, 2005 13:19
Beiträge: 98
Wohnort: Jahnsdorf
Die angegebenen Koordinaten sind IMHO Kugel-Koordinaten auf der Oberfläche ... (bzw. in der angegebenen Höhe)

_________________
Administrator of Project Omorphia
Bild


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: So Mai 14, 2006 13:36 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
i am not going for the glu.orhto2d solution.

Some further research on kugel-koordinaten got me this:

Zitat:
Q17. How do I convert Euclidean to Polar coordinates?
-----------------------------------------------------

With a Euclidean coordinate (x y z), the goal is to convert it into a
Polar coordinate (latitude, longitude, distance).

The conversion is as follows:

-----------------------------------------
distance = sqrt( x*x + y*y + z*z )

x /= distance;
y /= distance;
z /= distance;

xz_dist = sqrt( x*x + z*z )
latitude = atan2( xz_dist, y ) * RADIANS
longitude = atan2( x, z ) * RADIANS
-----------------------------------------


Q18. How do I convert Polar to Euclidean coordinates?
-----------------------------------------------------

With a Polar coordinate (latitude, longitude, distance), the goal is to
convert it into a Euclidean coordinate (x y z).

The conversion is as follows:

-----------------------------------------
x = cos( latitude ) . sin( longitude )
y = sin( latitude )
z = cos( latitude ) . cos( longitude )
-----------------------------------------


From: http://web.archive.org/web/200410111938 ... atest.html

Q18 should be the way to go, but this puzles me a bit as where te leave the third number from the kml file. Or should that be left as is?

As i already guesed the 3rd number is latitude. So i gues i can leave it unchanged (not sure though).

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Mai 15, 2006 15:08 
Offline
DGL Member

Registriert: Fr Dez 19, 2003 14:27
Beiträge: 107
Wohnort: Indianapolis, USA
Sorry to dissapoint you but the earth is no Sphere :-). It's an ellipsoid and I think google earth uses WGS84 for it's coordinate projections. Which use an ellipsoid as it's base and not a sphere. A poolar to euclidean conversion may still be good enough but as bigger the models as less aquarate it will become.

Zitat:
Q18 should be the way to go, but this puzles me a bit as where te leave the third number from the kml file. Or should that be left as is?
As i already guesed the 3rd number is latitude. So i gues i can leave it unchanged (not sure though).


The third component is the altitude, you just build an altitude vector and add it to the x,y,z you get from the comversion.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: So Nov 25, 2007 11:58 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Sorry to kick this topic, but i found this nice obj export script for Google Sketchup:

http://sketchuptips.blogspot.com/2007/0 ... orter.html

It needs some tweeking and improvement. But it does its job nice for single non materialized meshes.

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Nov 26, 2007 19:03 
Offline
Guitar Hero
Benutzeravatar

Registriert: Do Sep 25, 2003 15:56
Beiträge: 7804
Wohnort: Sachsen - ERZ / C
Programmiersprache: Java (, Pascal)
kml ist ein ziemlich cooles, weil einfach zu verstehendes Format.

Genial ist, dass man in Google-Maps eine URL zu einem KML File angeben kann, und dies dann in Google-Maps angezeigt wird. So kann man ziemlich nett Infos visualisieren.

_________________
Blog: kevin-fleischer.de und fbaingermany.com


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Nov 26, 2007 20:14 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
The problem with kml is not the format but how coords are represented. Sure they are great for Google Earth. But they are not for when you want to use it with opengl in your own application.

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Jan 29, 2008 20:16 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Google now also released an sdk for the sketchup fileformat: http://code.google.com/apis/sketchup/do ... ubmit.html

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 10 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 11 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.017s | 16 Queries | GZIP : On ]