[Mapserver-users] What am i doing wrong in this C program?

Daniel Morissette dmorissette at dmsolutions.ca
Thu Mar 4 16:01:30 EST 2004


Note that some members of the mapObj and layerObj (e.g. name, template, 
etc.) are pointers and may be NULL if they were not set in the mapfile. 
  You need to check that they are not NULL before printing them.

Daniel


mountainduo at mho.com wrote:
> Hello,
> 
> i am trying to access the layers of a mapObj and when i do, i get an
> exception access violation...it seems that the layers are not initialized.
> do i need to do anything other than msLoadMap?
> 
> thanks
> 
>     theMap = (mapObj*)msLoadMap( filename, NULL );
> 
>     printf( "Map->name %s\n", theMap->name );
>     printf( "Map->status %i\n", theMap->status );
>     printf( "Map->height %i\n", theMap->height );
>     printf( "Map->width %i\n", theMap->width );
>     printf( "Map->numlayers %i\n", theMap->numlayers );
>     printf( "Map->transparent %i\n", theMap->transparent );
>     printf( "Map->interlace %i\n", theMap->interlace );
>     printf( "Map->imagequality %i\n", theMap->imagequality );
>     printf( "Map->cellsize %i\n", theMap->cellsize );
>     printf( "Map->extent.minx %i\n", theMap->extent.minx );
>     printf( "Map->extent.miny %i\n", theMap->extent.miny );
>     printf( "Map->extent.maxx %i\n", theMap->extent.maxx );
>     printf( "Map->extent.maxy %i\n", theMap->extent.maxy );
>     printf( "Map->units %i\n", theMap->units );
>     printf( "Map->scale %i\n", theMap->scale );
>     printf( "Map->resolution %i\n", theMap->resolution );
>     printf( "Map->shapepath %s\n", theMap->shapepath );
>     printf( "Map->numoutputformats %i\n", theMap->numoutputformats );
> 
>     printf( "layers size %i\n", sizeof(theMap->layers) );
>     for ( x = 0; x < theMap->numlayers; x++ )
>     {
>         printf( "theMap->layer[%i].name: %s\n", x, theMap->layers[x].name );
> 
>     }//end for x
> 
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 





More information about the mapserver-users mailing list