MCPcopy Index your code
hub / github.com/MapServer/MapServer / msTileSetProjections

Function msTileSetProjections

maptile.c:517–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515 ************************************************************************/
516
517int msTileSetProjections(mapObj* map) {
518
519 char *mapProjStr = NULL;
520 int i;
521
522 if (map->projection.numargs <= 0) {
523 msSetError(MS_WMSERR, "Cannot set new SRS on a map that doesn't "
524 "have any projection set. Please make sure your mapfile "
525 "has a PROJECTION defined at the top level.",
526 "msTileSetProjectionst()");
527 return(MS_FAILURE);
528 }
529
530 for(i=0; i<map->numlayers; i++) {
531 /* This layer is turned on and needs a projection? */
532 if (GET_LAYER(map, i)->projection.numargs <= 0 &&
533 GET_LAYER(map, i)->status != MS_OFF &&
534 GET_LAYER(map, i)->transform == MS_TRUE) {
535
536 /* Fetch main map projection string only now that we need it */
537 if (mapProjStr == NULL)
538 mapProjStr = msGetProjectionString(&(map->projection));
539
540 /* Set the projection to the map file projection */
541 if (msLoadProjectionString(&(GET_LAYER(map, i)->projection), mapProjStr) != 0) {
542 msSetError(MS_CGIERR, "Unable to set projection on layer.", "msTileSetProjectionst()");
543 return(MS_FAILURE);
544 }
545 GET_LAYER(map, i)->project = MS_TRUE;
546 }
547 }
548 msFree(mapProjStr);
549 return(MS_SUCCESS);
550}
551
552/************************************************************************
553 * msDrawTile *

Callers 1

msTileSetupFunction · 0.85

Calls 4

msSetErrorFunction · 0.85
msGetProjectionStringFunction · 0.85
msLoadProjectionStringFunction · 0.85
msFreeFunction · 0.85

Tested by

no test coverage detected