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

mountainduo at mho.com mountainduo at mho.com
Thu Mar 4 17:08:55 EST 2004


I definelty have layers in my mapfile. are there certain required fields
needed in order for the load function to load the layers (i looked at the
reference doc but could not tell if something was required)? if i have a
layer as default or on, i can display the map but i want to dynamically
turn on or off layers.

or are there other certain objects that are required in order for the
layer object to load?

> 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
>>
>
>
> _______________________________________________
> 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