[Mapserver-users] Python Mapscript: Get All Outputformat in Mapfile
Jan Schüngel
jschuengel at intevation.de
Thu Jul 8 01:22:46 PDT 2004
Sean Gillies schrieb:
> On Jul 7, 2004, at 6:24 AM, Jan Schüngel wrote:
>
>> Hi,
>>
>> i am coding a python program to edit the mapscript. Now I am
>> searching for a way to get all outputformats in the mapfile and which
>> outputformats are supported too.
>>
>> when i use mymap.outputformats i only get the one which is set by
>> imagetype. And i can get the outputformat by
>> mymap.getOutputFormatByName(mymap.imagetype).
>>
>> the numoutputformats gives me the number 6 when i create a new empty
>> mapfile (mymap = mapscript.mapObj("") but i have found no way to find
>> out which outputformats are these.
>>
>> I only can get the outputformat by name, but i don't know the names
>> of the formats.
>> Is there anybody who can help me ?
>>
>> Greets
>> J. S.
>>
>> P.S.: Sorry for my bad english.
>
>
> Hi Jan,
>
> You write english well. Do not be sorry :)
>
> The mapscript module now lacks a method to iterate over the formats
> in mapObj.formats. The most likely names for built-in formats are
>
> ['gif', 'png', 'png24', 'jpeg', 'wbmp', 'swf', 'pdf', 'imagemap']
>
> to find out what you have in the map, you do something like this:
>
> formats = []
> for fmtname in ['gif', 'png', 'png24', ...]:
> format = mymap.getOutputFormatByName(fmtname)
> if format:
> formats.append(format)
>
> In the future, we should probably have a getOutputFormat() method
> that works like getLayer() and that would allow
>
> formats = [mymap.getOutputFormat(i) for i in
> range(maymap.numoutputformats)]
>
> but this will not be available until the 4.4 release at the soonest.
>
> cheers,
> Sean
>
> --
> Sean Gillies
> sgillies at frii dot com
> http://users.frii.com/sgillies
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
Thanks, that works fine first, but that i must define the formats in
the program still disturbs me is.
I hope 4.4 will come sooner as soon, so i don't need to define the
formats and get it by the id.
Thanks again
J.S.
More information about the MapServer-users
mailing list