| 1185 | */ |
| 1186 | |
| 1187 | int msLoadMapContextURL(mapObj *map, char *urlfilename, int unique_layer_names) |
| 1188 | { |
| 1189 | #if defined(USE_WMS_LYR) && defined(USE_OGR) |
| 1190 | char *pszTmpFile = NULL; |
| 1191 | int status = 0; |
| 1192 | |
| 1193 | if (!map || !urlfilename) |
| 1194 | { |
| 1195 | msSetError(MS_MAPCONTEXTERR, |
| 1196 | "Invalid map or url given.", |
| 1197 | "msGetMapContextURL()"); |
| 1198 | return MS_FAILURE; |
| 1199 | } |
| 1200 | |
| 1201 | pszTmpFile = msTmpFile(map, map->mappath, NULL, "context.xml"); |
| 1202 | if (msHTTPGetFile(urlfilename, pszTmpFile, &status,-1, 0, 0) == MS_SUCCESS) |
| 1203 | { |
| 1204 | return msLoadMapContext(map, pszTmpFile, unique_layer_names); |
| 1205 | } |
| 1206 | else |
| 1207 | { |
| 1208 | msSetError(MS_MAPCONTEXTERR, |
| 1209 | "Could not open context file %s.", |
| 1210 | "msGetMapContextURL()", urlfilename); |
| 1211 | return MS_FAILURE; |
| 1212 | } |
| 1213 | |
| 1214 | #else |
| 1215 | msSetError(MS_MAPCONTEXTERR, |
| 1216 | "Not implemented since Map Context is not enabled.", |
| 1217 | "msGetMapContextURL()"); |
| 1218 | return MS_FAILURE; |
| 1219 | #endif |
| 1220 | } |
| 1221 | /* msLoadMapContext() |
| 1222 | ** |
| 1223 | ** Get a mapfile from a OGC Web Map Context format |
no test coverage detected