Index: src/webservice/htdocs/SiWeather/Webservice/GeoLocator.php
===================================================================
--- src/webservice/htdocs/SiWeather/Webservice/GeoLocator.php	(revision 69c8290d986bf7747eb3cd7e94832b36ce89fdcf)
+++ src/webservice/htdocs/SiWeather/Webservice/GeoLocator.php	(revision 69c8290d986bf7747eb3cd7e94832b36ce89fdcf)
@@ -0,0 +1,136 @@
+<?php
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+namespace SiWeather\Webservice;
+
+/**
+  * @brief Retrieves geo location data for different input data
+  *
+  * Returns null if someting failed.
+  *
+  * @note Requires Services_GeoNames
+  */
+class GeoLocator
+{
+	private static $_serviceBaseUrl = "http://api.geonames.org/";
+
+	public static function configured(){
+		if(empty(self::$_serviceBaseUrl))
+			return false;
+		if(!self::getUsername())
+			return false;
+		return true;
+	}
+
+	/**
+		* @brief Get locations within radius @p radius around @p latitude and @p longitude.
+		* 
+		* Returns an array of Location objects.
+		*
+		* @see Location
+		*/
+	public static function locations($latitude, $longitude, $radius, &$errorMessage){
+		if(!Location::validLatitude($latitude)){
+			$errorMessage = "GeoLocator: ". $latitude ." is no valid latitude";
+			return false;
+		}
+		if(!Location::validLatitude($longitude)){
+			$errorMessage = "GeoLocator: ".$longitude ."is no valid longitude";
+			return false;
+		}
+		if(!$radius || !is_numeric($radius) || $radius < 1){
+			$errorMessage = "GeoLocator: No or invalid radius given (". $radius .")";
+			return false;
+		}
+	
+		$user = self::getUsername();
+		if(!$user){
+			$errorMessage = "geonames webservice not configured";
+			return false;
+		}
+
+		$client = new \GuzzleHttp\Client
+		(
+			[
+				"base_uri" => self::$_serviceBaseUrl,
+				"timeout" => 2.0,								# we need a very small timeout here, because otherwise the request of our caller function may time out!
+				"http_errors" => false,
+			]
+		);
+		try{
+			$response = $client->get("findNearbyPlaceNameJSON?lat=". $latitude ."&lng=". $longitude ."&username=". $user ."&lang=local&radius=". $radius ."&style=full");
+		}
+		catch(Exception $exception){
+			$errorMessage = "GeoLocator: Fetched connect exception: ". $exception->getMessage();
+			error_log($errorMessage);
+			return false;
+		}
+		if(is_null($response)){
+			$errorMessage = "GeoLocator: Failed to fetch locations";
+			error_log($errorMessage);
+			return false;
+		}
+		if($response->getStatusCode() != 200){
+			if($response->getStatusCode() == 403){
+				$errorMessage = "GeoLocator: Probably too many ". $baseUrl ." requests (>2000/hour or >30000/day). Reason:". $response->getReasonPhrase();
+			}
+			else{
+				$errorMessage = "GeoLocator: Request failed with code ". $response->getStatusCode() ." and reason ". $response->getReasonPhrase();
+			}
+			error_log($errorMessage);
+			return false;
+		}
+
+		$body = $response->getBody();
+		if(empty($body)){
+			$errorMessage = "GeoLocator: Returned empty body";
+			error_log($errorMessage);
+			return false;
+		}
+		$json = json_decode($body, true);
+		if(is_null($json) || !$json || !is_array($json) || !array_key_exists("geonames", $json)){
+			$errorMessage = "GeoLocator: Could not convert answer into json data\n". $body;
+			error_log($errorMessage);
+			return false;
+		}
+		
+		$result = array();
+		foreach($json["geonames"] as $geoname){
+			$result[] = new Location($geoname["name"], "",
+									$geoname["adminName1"], $geoname["adminCode1"],
+									$geoname["countryName"], $geoname["countryCode"],
+									$geoname["lat"], $geoname["lng"],
+									$geoname["timezone"]["timeZoneId"]);
+		}
+		return $result;
+	}
+
+	private static function getUsername(){
+		$webserviceConfig = new WebserviceConfig();
+		$user = $webserviceConfig->getConfig("geonamesUsername");
+		if(!$user || empty($user)){
+			error_log("GeoLocator: No geonamesUsername set. Please adjust your webservice configuration");
+			return false;
+		}
+		return $user;
+	}
+}
+
+?>
Index: src/webservice/htdocs/SiWeather/Webservice/IpGeoLocator.php
===================================================================
--- src/webservice/htdocs/SiWeather/Webservice/IpGeoLocator.php	(revision b5ebb8df50cf75e9fd286740f30b7f4334d5a14a)
+++ 	(revision )
@@ -1,98 +1,0 @@
-<?php
-/*
-    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library 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
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-    MA 02110-1301  USA.
-*/
-
-namespace SiWeather\Webservice;
-
-/**
-  * @brief Translates an IP Address into City, Country, Region, Zipcode, Latitude, Longitude, Time/Zone
-  *
-  * Returns null if someting failed.
-  */
-class IpGeoLocator
-{
-	public static function locate($ip, &$errorMessage){
-		if(!$ip || empty($ip)){
-			$errorMessage = "IpGeoLocator: No ip given";
-			return null;
-		}
-	
-		$config = new WebserviceConfig();
-		$baseUrl = $config->getConfig("geoipservice");
-		if(!$baseUrl || empty($baseUrl)){
-			$errorMessage = "IpGeoLocator: No geo ip service base url set (see config \"geoipservice\")";
-			error_log($errorMessage);
-			return null;
-		}
-	
-		$client = new \GuzzleHttp\Client
-		(
-			[
-				"base_uri" => $baseUrl,
-				"timeout" => 1.0,								# we need a very small timeout here, because otherwise the request of our caller function may time out!
-				"http_errors" => false,
-			]
-		);
-		try{
-			$response = $client->get("/json/". $ip);
-		}
-		catch(\GuzzleHttp\Exception\ConnectException $exception){
-			$errorMessage = "IpGeoLocator: Fetched connect exception (mostly timeout): ". $exception->getMessage();
-			error_log($errorMessage);
-			return null;
-		}
-		if(is_null($response)){
-			$errorMessage = "IpGeoLocator: Failed to fetch ip";
-			error_log($errorMessage);
-			return null;
-		}
-		if($response->getStatusCode() != 200){
-			if($response->getStatusCode() == 403){
-				$errorMessage = "IpGeoLocator: Probably too many ". $baseUrl ." requests (>10000/hour). Reason:". $response->getReasonPhrase();
-			}
-			else{
-				$errorMessage = "IpGeoLocator: Request failed with code ". $response->getStatusCode() ." and reason ". $response->getReasonPhrase();
-			}
-			error_log($errorMessage);
-			return null;
-		}
-
-		$body = $response->getBody();
-		if(empty($body)){
-			$errorMessage = "IpGeoLocator: Returned empty body";
-			error_log($errorMessage);
-			return null;
-		}
-		$json = json_decode($body, TRUE);
-		if(is_null($json) || !$json || !is_array($json)){
-			$errorMessage = "IpGeoLocator: Could not convert answer into json data\n". $body;
-			error_log($errorMessage);
-			return null;
-		}
-		
-		$location = new Location($json["city"], $json["zip_code"],
-								 $json["region_name"], $json["region_code"],
-								 $json["country_name"], $json["country_code"],
-								 $json["latitude"], $json["longitude"],
-								 $json["time_zone"]);
-		return $location;
-	}
-}
-
-?>
Index: src/webservice/htdocs/SiWeather/Webservice/Setup.php
===================================================================
--- src/webservice/htdocs/SiWeather/Webservice/Setup.php	(revision b5ebb8df50cf75e9fd286740f30b7f4334d5a14a)
+++ src/webservice/htdocs/SiWeather/Webservice/Setup.php	(revision 69c8290d986bf7747eb3cd7e94832b36ce89fdcf)
@@ -203,31 +203,31 @@
 		}
 		
-		// prepare countries table
-		$table = "countries";
-		if(!$this->databaseTableExists($table)){
-			$sql  = "CREATE TABLE ". $table ." (";
-			$sql .= "  id INTEGER NOT NULL PRIMARY KEY,";
-			$sql .= "  name TEXT NOT NULL,";
-			$sql .= "  code VARCHAR(2)";
-			$sql .= ")";
-			if(!$this->databaseTableCreate($table, $sql, $errorMessage)){
-				return false;
-			}
-		}
-		
-		// prepare regions table
-		$table = "regions";
-		if(!$this->databaseTableExists($table)){
-			$sql  = "CREATE TABLE ". $table ." (";
-			$sql .= "  id INTEGER NOT NULL PRIMARY KEY,";
-			$sql .= "  name TEXT NOT NULL,";
-			$sql .= "  code VARCHAR(2),";
-			$sql .= "  country INTEGER,";
-			$sql .= "  FOREIGN KEY(country) REFERENCES countries(id)";
-			$sql .= ")";
-			if(!$this->databaseTableCreate($table, $sql, $errorMessage)){
-				return false;
-			}
-		}
+// 		// prepare countries table
+// 		$table = "countries";
+// 		if(!$this->databaseTableExists($table)){
+// 			$sql  = "CREATE TABLE ". $table ." (";
+// 			$sql .= "  id INTEGER NOT NULL PRIMARY KEY,";
+// 			$sql .= "  name TEXT NOT NULL,";
+// 			$sql .= "  code VARCHAR(2)";
+// 			$sql .= ")";
+// 			if(!$this->databaseTableCreate($table, $sql, $errorMessage)){
+// 				return false;
+// 			}
+// 		}
+// 		
+// 		// prepare regions table
+// 		$table = "regions";
+// 		if(!$this->databaseTableExists($table)){
+// 			$sql  = "CREATE TABLE ". $table ." (";
+// 			$sql .= "  id INTEGER NOT NULL PRIMARY KEY,";
+// 			$sql .= "  name TEXT NOT NULL,";
+// 			$sql .= "  code VARCHAR(2),";
+// 			$sql .= "  country INTEGER,";
+// 			$sql .= "  FOREIGN KEY(country) REFERENCES countries(id)";
+// 			$sql .= ")";
+// 			if(!$this->databaseTableCreate($table, $sql, $errorMessage)){
+// 				return false;
+// 			}
+// 		}
 
 		// prepare cities table
@@ -236,8 +236,5 @@
 			$sql  = "CREATE TABLE ". $table ." (";
 			$sql .= "  id INTEGER NOT NULL PRIMARY KEY,";
-			$sql .= "  name TEXT NOT NULL,";
-			$sql .= "  zipcode TEXT,";
-			$sql .= "  region INTEGER,";
-			$sql .= "  FOREIGN KEY(region) REFERENCES regions(id)";
+			$sql .= "  name TEXT NOT NULL";
 			$sql .= ")";
 			if(!$this->databaseTableCreate($table, $sql, $errorMessage)){
@@ -261,4 +258,6 @@
 			$sql .= "  name TEXT NOT NULL,";
 			$sql .= "  city INTEGER,";
+			$sql .= "  uuid TEXT NOT NULL,";
+			$sql .= "  ownerMail TEXT NOT NULL,";
 			$sql .= "  FOREIGN KEY(city) REFERENCES cities(id)";
 			$sql .= ")";
