Thomas Fletcher
05-19-2010, 08:47 PM
I am trying to Use the objects FSRW and GPS_Float to make a Google Earth .kml file,
but I am having trouble writing the real numbers Float_Longitude_Deg and Float_Latitude_Deg
to the file on the sd card.
I believe the problem is at
sdcard.sdstr(gps.Float_Longitude_Deg)
sdcard.sdstr(string(","))
sdcard.sdstr(gps.Float_Latitude_Deg)
sdcard.sdstr(string(","))
sdcard.sdstr(string("155"))
sdcard.sdstr(string(13,10))
It writes
0,0,155
0,0,155
0,0,155
to the file.
I am sure this has been discussed before, but I can't find a thread with search.
CON
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
obj
sdcard: "fsrw"
gps: "GPS_Float"
var
long start
pub main
sdcard.mount(3)
sdcard.popen(string("text.kml"),"w")
if gps.init
sdcard.SDStr(string("<?xml version='1.0' encoding='UTF-8'?>",13,10))
sdcard.SDStr(string("<kml xmlns='http://www.opengis.net/kml/2.2'>",13,10))
sdcard.SDStr(string(" <Document>",13,10))
sdcard.SDStr(string(" <name>Paths</name>",13,10))
sdcard.SDStr(string("<description>This is a test run of collecting GPS data</description>",13,10))
sdcard.SDStr(string("<Style id='yellowLineGreenPoly'>",13,10))
sdcard.SDStr(string(" <LineStyle>",13,10))
sdcard.SDStr(string(" <color>7f00ffff</color>",13,10))
sdcard.SDStr(string(" <width>4</width>",13,10))
sdcard.SDStr(string(" </LineStyle>",13,10))
sdcard.SDStr(string(" <PolyStyle>",13,10))
sdcard.SDStr(string(" <color>7f00ff00</color>",13,10))
sdcard.SDStr(string(" </PolyStyle>",13,10))
sdcard.SDStr(string(" </Style>",13,10))
sdcard.SDStr(string(" <Placemark>",13,10))
sdcard.SDStr(string(" <name>Absolute Extruded</name>",13,10))
sdcard.SDStr(string(" <description>Transparent green wall with yellow outlines</description>",13,10))
sdcard.SDStr(string(" <styleUrl>#yellowLineGreenPoly</styleUrl>",13,10))
sdcard.SDStr(string(" <LineString>",13,10))
sdcard.SDStr(string(" <extrude>1</extrude>",13,10))
sdcard.SDStr(string(" <tessellate>1</tessellate>",13,10))
sdcard.SDStr(string(" <altitudeMode>absolute</altitudeMode>",13,10))
sdcard.SDStr(string("<coordinates>"))
repeat 10000
sdcard.sdstr(gps.Float_Longitude_Deg)
sdcard.sdstr(string(","))
sdcard.sdstr(gps.Float_Latitude_Deg)
sdcard.sdstr(string(","))
sdcard.sdstr(string("155"))
sdcard.sdstr(string(13,10))
sdcard.SDStr(string("</coordinates>",13,10))
sdcard.SDStr(string(" </LineString>",13,10))
sdcard.SDStr(string(" </Placemark>",13,10))
sdcard.SDStr(string(" </Document>",13,10))
sdcard.SDStr(string("</kml>",13,10))
else
sdcard.SDStr(string("GPS failed to start",13,10))
sdcard.pclose
Lightblink
Pub Lightblink
dira~~
repeat 9
!outa
waitcnt(9_000_000 + cnt)
The file created
<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns='http://www.opengis.net/kml/2.2'>
<Document>
<name>Paths</name>
<description>This is a test run of collecting GPS data</description>
<Style id='yellowLineGreenPoly'>
<LineStyle>
<color>7f00ffff</color>
<width>4</width>
</LineStyle>
<PolyStyle>
<color>7f00ff00</color>
</PolyStyle>
</Style>
<Placemark>
<name>Absolute Extruded</name>
<description>Transparent green wall with yellow outlines</description>
<styleUrl>#yellowLineGreenPoly</styleUrl>
<LineString>
<extrude>1</extrude>
<tessellate>1</tessellate>
<altitudeMode>absolute</altitudeMode>
<coordinates>0,0,155
0,0,155
0,0,155
0,0,155
.......many more
</coordinates>
</LineString>
</Placemark>
</Document>
</kml>
but I am having trouble writing the real numbers Float_Longitude_Deg and Float_Latitude_Deg
to the file on the sd card.
I believe the problem is at
sdcard.sdstr(gps.Float_Longitude_Deg)
sdcard.sdstr(string(","))
sdcard.sdstr(gps.Float_Latitude_Deg)
sdcard.sdstr(string(","))
sdcard.sdstr(string("155"))
sdcard.sdstr(string(13,10))
It writes
0,0,155
0,0,155
0,0,155
to the file.
I am sure this has been discussed before, but I can't find a thread with search.
CON
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
obj
sdcard: "fsrw"
gps: "GPS_Float"
var
long start
pub main
sdcard.mount(3)
sdcard.popen(string("text.kml"),"w")
if gps.init
sdcard.SDStr(string("<?xml version='1.0' encoding='UTF-8'?>",13,10))
sdcard.SDStr(string("<kml xmlns='http://www.opengis.net/kml/2.2'>",13,10))
sdcard.SDStr(string(" <Document>",13,10))
sdcard.SDStr(string(" <name>Paths</name>",13,10))
sdcard.SDStr(string("<description>This is a test run of collecting GPS data</description>",13,10))
sdcard.SDStr(string("<Style id='yellowLineGreenPoly'>",13,10))
sdcard.SDStr(string(" <LineStyle>",13,10))
sdcard.SDStr(string(" <color>7f00ffff</color>",13,10))
sdcard.SDStr(string(" <width>4</width>",13,10))
sdcard.SDStr(string(" </LineStyle>",13,10))
sdcard.SDStr(string(" <PolyStyle>",13,10))
sdcard.SDStr(string(" <color>7f00ff00</color>",13,10))
sdcard.SDStr(string(" </PolyStyle>",13,10))
sdcard.SDStr(string(" </Style>",13,10))
sdcard.SDStr(string(" <Placemark>",13,10))
sdcard.SDStr(string(" <name>Absolute Extruded</name>",13,10))
sdcard.SDStr(string(" <description>Transparent green wall with yellow outlines</description>",13,10))
sdcard.SDStr(string(" <styleUrl>#yellowLineGreenPoly</styleUrl>",13,10))
sdcard.SDStr(string(" <LineString>",13,10))
sdcard.SDStr(string(" <extrude>1</extrude>",13,10))
sdcard.SDStr(string(" <tessellate>1</tessellate>",13,10))
sdcard.SDStr(string(" <altitudeMode>absolute</altitudeMode>",13,10))
sdcard.SDStr(string("<coordinates>"))
repeat 10000
sdcard.sdstr(gps.Float_Longitude_Deg)
sdcard.sdstr(string(","))
sdcard.sdstr(gps.Float_Latitude_Deg)
sdcard.sdstr(string(","))
sdcard.sdstr(string("155"))
sdcard.sdstr(string(13,10))
sdcard.SDStr(string("</coordinates>",13,10))
sdcard.SDStr(string(" </LineString>",13,10))
sdcard.SDStr(string(" </Placemark>",13,10))
sdcard.SDStr(string(" </Document>",13,10))
sdcard.SDStr(string("</kml>",13,10))
else
sdcard.SDStr(string("GPS failed to start",13,10))
sdcard.pclose
Lightblink
Pub Lightblink
dira~~
repeat 9
!outa
waitcnt(9_000_000 + cnt)
The file created
<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns='http://www.opengis.net/kml/2.2'>
<Document>
<name>Paths</name>
<description>This is a test run of collecting GPS data</description>
<Style id='yellowLineGreenPoly'>
<LineStyle>
<color>7f00ffff</color>
<width>4</width>
</LineStyle>
<PolyStyle>
<color>7f00ff00</color>
</PolyStyle>
</Style>
<Placemark>
<name>Absolute Extruded</name>
<description>Transparent green wall with yellow outlines</description>
<styleUrl>#yellowLineGreenPoly</styleUrl>
<LineString>
<extrude>1</extrude>
<tessellate>1</tessellate>
<altitudeMode>absolute</altitudeMode>
<coordinates>0,0,155
0,0,155
0,0,155
0,0,155
.......many more
</coordinates>
</LineString>
</Placemark>
</Document>
</kml>