[Mapbender-commits] r8942 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Jun 27 07:12:03 PDT 2014


Author: hwbllmnn
Date: 2014-06-27 07:12:03 -0700 (Fri, 27 Jun 2014)
New Revision: 8942

Added:
   trunk/mapbender/http/php/uploadKml.php
Log:
added kml upload endpoint


Added: trunk/mapbender/http/php/uploadKml.php
===================================================================
--- trunk/mapbender/http/php/uploadKml.php	                        (rev 0)
+++ trunk/mapbender/http/php/uploadKml.php	2014-06-27 14:12:03 UTC (rev 8942)
@@ -0,0 +1,42 @@
+<?php
+# http://www.mapbender.org/index.php/Administration
+# Copyright (C) 2002 CCGIS
+#
+# 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 2, 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__) . "/../classes/class_kml_ows.php");
+
+
+header("Content-Type: application/vnd.geo+json");
+
+$kml = new KML();
+$kmlString = file_get_contents($_FILES['kml']['tmp_name']);
+try {
+
+	if($kml->parseKml($kmlString)){
+		$geojson  =  $kml->toGeoJSON();
+		echo $geojson;
+	}else{
+		echo("{}");
+	}
+
+
+} catch (Exception $e) {
+	echo($e);
+	die;
+}
+
+?>



More information about the Mapbender_commits mailing list