source: extensions/piwigo-openstreetmap/include/functions_map.php @ 29761

Last change on this file since 29761 was 24677, checked in by ddtddt, 11 years ago

[extensions] - piwigo-openstreetmap - add file for translate

File size: 1.6 KB
Line 
1<?php
2/***********************************************
3* File      :   functions_map.php
4* Project   :   piwigo-openstreetmap
5* Descr     :   Read Geotag Metdata
6* Base on   :   RV Maps & Earth plugin
7*
8* Created   :   30.05.2013
9*
10* Copyright 2013 <xbgmsharp@gmail.com>
11*
12* This program is free software: you can redistribute it and/or modify
13* it under the terms of the GNU General Public License as published by
14* the Free Software Foundation, either version 3 of the License, or
15* (at your option) any later version.
16*
17* This program is distributed in the hope that it will be useful,
18* but WITHOUT ANY WARRANTY; without even the implied warranty of
19* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20* GNU General Public License for more details.
21*
22* You should have received a copy of the GNU General Public License
23* along with this program.  If not, see <http://www.gnu.org/licenses/>.
24*
25************************************************/
26
27
28function osm_parse_map_data_url($tokens, &$next_token)
29{
30    $page = parse_section_url($tokens, $next_token);
31    if ( !isset($page['section']) )
32      $page['section'] = 'categories';
33 
34    $page = array_merge( $page, parse_well_known_params_url( $tokens, $next_token) );
35    $page['start']=0;
36    $page['box'] = osm_bounds_from_url( @$_GET['box'] );
37    return $page;
38}
39
40function osm_bounds_from_url($str)
41{
42  if ( !isset($str) or strlen($str)==0 )
43    return null;
44  $r = explode(',', $str );
45  if ( count($r) != 4)
46    bad_request( $str.' is not a valid geographical bound' );
47  $b = array(
48    's' => $r[0],
49    'w' => $r[1],
50    'n' => $r[2],
51    'e' => $r[3],
52  );
53  return $b;
54}
55
56?>
Note: See TracBrowser for help on using the repository browser.