return {'lon': center[0], 'lat': center[1], 'zoom': zoom}, json
-def parse_wrmap_coordinates(coordinates_str):
+def parse_wrmap_coordinates(coords):
+ '''gets a string coordinates and returns an array of lon/lat coordinate pairs, e.g.
+ 47.12 N 11.87 E
+ 47.13 N 11.70 E
+ ->
+ [[11.87, 47.12], [11.70, 47.13]]'''
+ '''
+ $matches = array();
+ $num_matches = preg_match_all('/\s*(\d+\.?\d*)\s*N?\s+(\d+\.?\d*)\s*E?\s*/', $input, $matches);
+ $result = array();
+ for ($i=0; $i!=$num_matches; ++$i) {
+ $result[] = array(floatval($matches[2][$i]), floatval($matches[1][$i]));
+ }
+ if (implode($matches[0]) != $input) throw new Exception('Falsches Koordinatenformat: ' . $input);
+ return $result;
+ }
+
+ Think of using re.sub(pattern, repl, string, count=0, flags=0)
+ '''
return [[0, 0]] # TODO