|
110 | 110 | $infos = array(); |
111 | 111 | foreach ($images as $image) |
112 | 112 | { |
113 | | - // Fech reverse location from API |
| 113 | + // Fetch reverse location from API |
114 | 114 | // http://wiki.openstreetmap.org/wiki/Nominatim |
115 | 115 | // https://nominatim.openstreetmap.org/reverse?format=xml&lat=51.082333&lon=10.366229&zoom=12 |
116 | 116 | // https://open.mapquestapi.com/nominatim/v1/reverse.php?format=xml&lat=48.858366666667&lon=2.2942166666667&zoom=12 |
117 | | - //$osm_url = "https://nominatim.openstreetmap.org/reverse?format=json&addressdetails=1&zoom=12&lat=". $image['latitude'] ."&lon=". $image['longitude']; |
| 117 | + $osm_url = "https://nominatim.openstreetmap.org/reverse?format=json&addressdetails=1&zoom=12&lat=". $image['latitude'] ."&lon=". $image['longitude'] ."&accept-language=". $sync_options['language']; |
118 | 118 | // As of Sept 2015 require a API KEY |
119 | 119 | //$osm_url = "https://open.mapquestapi.com/nominatim/v1/reverse.php?format=json&addressdetails=1&zoom=12&lat=". $image['latitude'] ."&lon=". $image['longitude']; |
120 | 120 | //$osm_url = "http://localhost:8443/api/". $image['latitude'] ."/". $image['longitude']; |
121 | | - $osm_url = "https://nominatim-xbgmsharp.rhcloud.com/api/". $image['latitude'] ."/". $image['longitude'] ."/". $sync_options['language']; |
| 121 | + //$osm_url = "https://nominatim-xbgmsharp.rhcloud.com/api/". $image['latitude'] ."/". $image['longitude'] ."/". $sync_options['language']; |
122 | 122 | //print $osm_url ."<br/>"; |
123 | 123 |
|
124 | 124 | // Ensure we do have PHP curl install |
|
149 | 149 | ); |
150 | 150 | $context = stream_context_create($opts); |
151 | 151 | if (false !== ($json = @file_get_contents($osm_url, flase, $context))) { |
152 | | - // all good |
| 152 | + // all good |
153 | 153 | //return $json; |
154 | 154 | } else { |
155 | 155 | // error happened |
156 | | - //return false; |
| 156 | + //return false; |
157 | 157 | $errors[] = "Error fetching reverse data"; |
158 | 158 | } |
159 | 159 | } |
|
166 | 166 | //print_r($response); |
167 | 167 |
|
168 | 168 | // If reponse include [address] |
169 | | - if (isset($response) and isset($response['success']) and isset($response['success'][0]) and isset($response['success'][0]['result']) |
170 | | - and isset($response['success'][0]['result']['address']) and is_array($response['success'][0]['result']['address'])) |
| 169 | + if (isset($response) and isset($response['address']) and is_array($response['address'])) |
171 | 170 | { |
172 | | - $response['address'] = $response['success'][0]['result']['address']; |
173 | 171 | //print_r($response['address']); |
174 | 172 | //print_r($sync_options); |
175 | 173 | $tag_names = array(); |
|
0 commit comments