Permalink
Browse files

WKML: Add examples

Two simple examples showing how to use the wkml API.
  • Loading branch information...
1 parent ac6b0b7 commit 1cea168d5b9a8b56c6d4c2c7e0a53ff770f43ee6 @andreww committed May 19, 2011
Showing with 39 additions and 22 deletions.
  1. +3 −0 .gitignore
  2. +5 −3 examples/Makefile
  3. +6 −19 examples/wkml_example.f90
  4. +25 −0 examples/wkml_example_2.f90
View
@@ -15,10 +15,13 @@ config.status
objs
wcml_example
wxml_example
+wkml_example
+wkml_example_2
sax_example
sax_example_2
dom_example
dom_example_2
+dom_example_3
.FoX
.config
*.exe
View
@@ -6,12 +6,12 @@ default: $(BUILD_TARGETS)
INCFLAGS=`../FoX-config --fcflags`
-EXAMPLES=dom_example_2$(EXEEXT) dom_example_3$(EXEEXT) sax_example$(EXEEXT) sax_example_2$(EXEEXT) wcml_example$(EXEEXT) wxml_example$(EXEEXT) wkml_example$(EXEEXT)
+EXAMPLES=dom_example_2$(EXEEXT) dom_example_3$(EXEEXT) sax_example$(EXEEXT) sax_example_2$(EXEEXT) wcml_example$(EXEEXT) wxml_example$(EXEEXT) wkml_example$(EXEEXT) wkml_example_2$(EXEEXT)
dom_lib: sax_lib wxml_lib dom_example_2$(EXEEXT) dom_example_3$(EXEEXT)
sax_lib: sax_example$(EXEEXT) sax_example_2$(EXEEXT)
wcml_lib: wxml_lib wcml_example$(EXEEXT)
-wkml_lib: wxml_lib wkml_example$(EXEEXT)
+wkml_lib: wxml_lib wkml_example$(EXEEXT) wkml_example_2$(EXEEXT)
wxml_lib: wxml_example$(EXEEXT)
# Note that we cannot use $< below since IBM make doesn't understand it.
@@ -42,6 +42,8 @@ wcml_example$(EXEEXT): wcml_example.$(OBJEXT) ../objs/lib/libFoX_wcml.$(LIBEXT)
wkml_example$(EXEEXT): wkml_example.$(OBJEXT) ../objs/lib/libFoX_wkml.$(LIBEXT) ../objs/lib/libFoX_wxml.$(LIBEXT) ../objs/lib/libFoX_common.$(LIBEXT) ../objs/lib/libFoX_fsys.$(LIBEXT)
$(FC) $(FFLAGS) $(LDFLAGS) $(LINK_O_FLAG) $@ wkml_example.$(OBJEXT) $$(../FoX-config --libs --wkml)
+wkml_example_2$(EXEEXT): wkml_example_2.$(OBJEXT) ../objs/lib/libFoX_wkml.$(LIBEXT) ../objs/lib/libFoX_wxml.$(LIBEXT) ../objs/lib/libFoX_common.$(LIBEXT) ../objs/lib/libFoX_fsys.$(LIBEXT)
+ $(FC) $(FFLAGS) $(LDFLAGS) $(LINK_O_FLAG) $@ wkml_example_2.$(OBJEXT) $$(../FoX-config --libs --wkml)
clean:
- rm -f *.$(OBJEXT) *.$(MOD_EXT) $(EXAMPLES) wkml_example.kml
+ rm -f *.$(OBJEXT) *.$(MOD_EXT) $(EXAMPLES) wkml_example.kml wkml_example_2.kml dom_example_3.xml
View
@@ -1,30 +1,17 @@
program wkml_example
-! this program read car accidents data of Cambridge
+ ! Example point plotting in KML using FoX_wkml
use FoX_wkml
implicit none
type(xmlf_t) :: myfile
- integer i,m
- parameter(m=10)
-
- double precision :: latitude(m), longitude(m)
-
-
- open(unit=90, file='wkml_example_input.txt',status='old')
-
-
-10 FORMAT(2x,F9.6,5x,F8.6)
- do i=1,m
- read (90,10) latitude(i), longitude(i)
- end do
-
-! print*, longitude
-
- close(90)
-
+ ! Data on the location of car accidents in Cambridge
+ real :: latitude(10) = (/52.178179, 52.210026, 52.204842, &
+ 52.176018, 52.173411, 52.209044, 52.213750, 52.226834, 52.214031, 52.207677/)
+ real :: longitude(10) = (/0.143026, 0.111787, 0.135543, &
+ 0.143683, 0.112742, 0.141804, 0.123205, 0.111618, 0.110557, 0.127060/)
call kmlBeginFile(myfile, "wkml_example.kml", -1)
call kmlCreatePoints(myfile, longitude, latitude)
@@ -0,0 +1,25 @@
+program path
+ ! Draw a line in the sky from the UK to Florida
+ use FoX_wkml
+
+ type(xmlf_t) :: myfile
+ character(len=25) :: filename
+ real :: latitude(10) = (/52.0000, 50.0000, 48.0000, 45.0000, 40.0000, 35.0000, 30.0000, 28.0000, 25.0000, 23.0000/)
+ real :: longitude(10) = (/0.0000, -5.0000, -10.0000, -20.0000, -30.0000, -40.0000, -50.0000, -60.0000, -70.0000, -80.0000/)
+ real :: zed(10) = (/2000.00, 10000.00, 30000.00, 60000.00, 80000.00, 80000.00, 80000.00, 60000.00, 40000.00, 30000.00/)
+
+ filename='wkml_example_2.kml'
+
+
+ call kmlBeginFile(myfile, filename, -1)
+ call kmlOpenDocument(myfile, "kmlCreateLine-path")
+ ! create the line style and th ereference id is "path"
+ call kmlCreateLineStyle(myfile, width=5,colorname="yellow", id="path")
+ ! create line and reference to the style "path" using argument styleURL="#path"
+ call kmlCreateLine(myfile, longitude, latitude, altitude=zed, &
+ altitudeMode="absolute",styleURL="#path")
+ call kmlCloseDocument(myfile)
+ call kmlFinishFile(myfile)
+
+
+end program path

0 comments on commit 1cea168

Please sign in to comment.