/* Author: Willem Robert van Hage E-mail: see webpage WWW: http://www.few.vu.nl/~wrvhage Copyright (C): 2009, Vrije Universiteit Amsterdam This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. For a copy of the GNU General Public License see: . */ :- use_module(library(http/thread_httpd)). :- use_module(library(http/http_dispatch)). :- use_module(library(http/http_parameters)). :- use_module(library(http/html_write)). :- use_module(library(space/space)). :- use_module(library(space/space_web_loader)). :- use_module(library(space/kml)). server(Port) :- http_server(http_dispatch, [port(Port)]). kml_handler(Request) :- http_parameters(Request, [ url(URL,[]) ]), format('Content-type: application/vnd.google-earth.kml+xml~n~n'), space_load_url(URL), kml_save_header(current_output, []), forall( uri_shape(URI, Shape), % INSERT RDFS AND SPATIAL QUERIES HERE IF YOU LIKE! kml_save_shape(current_output, placemark(Shape,['ID'=URI],[]), [ content([name(URI)]) ]) ), kml_save_footer(current_output), space_unload_url(URL). :- http_handler('/space.kml', kml_handler, []). :- server(8787).