[Mapserver-users] mapscript and float32 geotiffs

John Beisley - RSG josb at pml.ac.uk
Thu Jun 10 10:59:54 EDT 2004


This is a multi-part message in MIME format.
--------------020906010105070404080509
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Sean Gillies wrote:

> Hi John,
>
> The Python MapScript maintainer (me) and the GDAL guru (Frank)
> are both away from work at the users meeting.  I don't have
> the resources to test, but I do see several things right away.
>
> Here is 4.2 code that should work.  Note the differences
>
>     # format name should be passed as an arg to factory
>     new_format = mapscript.outputFormatObj('GDAL/GTiff', 'fgtiff')
>     new_format.imagemode = mapscript.MS_IMAGEMODE_FLOAT32
>
>     # Everything else is OK, no need to set mimetype or extension
>
>     # Insert into map.
>     your_map.appendOutputFormat(new_format)
>
>     # Activate
>     your_map.setImageType('fgtiff')
>
> I can't help but make a style suggestion -- mapscript.mapObj is
> a class.  If you name instances of this class mapObj as well, you
> will eventually run into trouble right?  Or maybe you are using
> the experimental next generation API with 'Map', 'Layer', etc, in
> which case carry on. :)
>
> Back to follow up on Monday.
> cheers,
> Sean
>
> -- 
> Sean Gillies
> sgillies at frii dot com
> http://users.frii.com/sgillies
>

Hi Sean,

Thanks for the prompt reply. Certainly your suggestion has helped me 
tidy up that part of my code which I was never very happy with. However, 
the segmentation fault remains. I have traced it to the msImageInitGD 
function where it tries to execute the line:

tpixels = image->img.gd->tpixels[line];

The problem being is that image->img.gd->tpixels is NULL and hence 
indexing it creates the segfault. I'm afraid that I don't know enough 
about the internals of Mapserver to work out why it is zero in this case.

Regards,

- John

-- 
Website: www.pml.ac.uk
Registered Charity No. 1091222
Company No. 4178503
-------------------------------------------------------------------
This e-mail, its content and any file attachments are confidential.
If you have received this e-mail in error please do not copy,
disclose it to any third party or use the contents or attachments
in any way. Please notify the sender by replying to this e-mail or
e-mail forinfo at pml.ac.uk and then delete the email without making
any copies or using it in any other way.
       
The content of this message may contain personal views which are
not the views of Plymouth Marine Laboratory unless specifically
stated.
       
Email transmission cannot be guaranteed to be secure or error free


--------------020906010105070404080509
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Sean Gillies wrote:<br>
<blockquote cite="mid0EFB4769-BAE2-11D8-9095-000D9329D732 at frii.com"
 type="cite">Hi John,
  <br>
  <br>
The Python MapScript maintainer (me) and the GDAL guru (Frank)
  <br>
are both away from work at the users meeting.&nbsp; I don't have
  <br>
the resources to test, but I do see several things right away.
  <br>
  <br>
Here is 4.2 code that should work.&nbsp; Note the differences
  <br>
  <br>
&nbsp;&nbsp;&nbsp; # format name should be passed as an arg to factory
  <br>
&nbsp;&nbsp;&nbsp; new_format = mapscript.outputFormatObj('GDAL/GTiff', 'fgtiff')
  <br>
&nbsp;&nbsp;&nbsp; new_format.imagemode = mapscript.MS_IMAGEMODE_FLOAT32
  <br>
  <br>
&nbsp;&nbsp;&nbsp; # Everything else is OK, no need to set mimetype or extension
  <br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;# Insert into map.
  <br>
&nbsp;&nbsp;&nbsp; your_map.appendOutputFormat(new_format)
  <br>
  <br>
&nbsp;&nbsp;&nbsp; # Activate
  <br>
&nbsp;&nbsp;&nbsp; your_map.setImageType('fgtiff')
  <br>
  <br>
I can't help but make a style suggestion -- mapscript.mapObj is
  <br>
a class.&nbsp; If you name instances of this class mapObj as well, you
  <br>
will eventually run into trouble right?&nbsp; Or maybe you are using
  <br>
the experimental next generation API with 'Map', 'Layer', etc, in
  <br>
which case carry on. :)
  <br>
  <br>
Back to follow up on Monday.
  <br>
cheers,
  <br>
Sean
  <br>
  <br>
--
  <br>
Sean Gillies
  <br>
sgillies at frii dot com
  <br>
<a class="moz-txt-link-freetext" href="http://users.frii.com/sgillies">http://users.frii.com/sgillies</a>
  <br>
  <br>
</blockquote>
<br>
Hi Sean,<br>
<br>
Thanks for the prompt reply. Certainly your suggestion has helped me
tidy up that part of my code which I was never very happy with.
However, the segmentation fault remains. I have traced it to the
msImageInitGD function where it tries to execute the line:<br>
<br>
<small><tt>tpixels = image-&gt;img.gd-&gt;tpixels[line];<br>
</tt></small><br>
The problem being is that <small><tt>image-&gt;img.gd-&gt;tpixels</tt>
<big>is NULL and hence indexing it creates the segfault. I'm afraid
that I don't know enough about the internals of Mapserver to work out
why it is zero in this case.<br>
<br>
Regards,<br>
<br>
- John<br>
<br>
</big></small>
<pre class="moz-signature" cols="72">-- 
Website: <a class="moz-txt-link-abbreviated" href="http://www.pml.ac.uk">www.pml.ac.uk</a>
Registered Charity No. 1091222
Company No. 4178503
-------------------------------------------------------------------
This e-mail, its content and any file attachments are confidential.
If you have received this e-mail in error please do not copy,
disclose it to any third party or use the contents or attachments
in any way. Please notify the sender by replying to this e-mail or
e-mail <a class="moz-txt-link-abbreviated" href="mailto:forinfo at pml.ac.uk">forinfo at pml.ac.uk</a> and then delete the email without making
any copies or using it in any other way.
       
The content of this message may contain personal views which are
not the views of Plymouth Marine Laboratory unless specifically
stated.
       
Email transmission cannot be guaranteed to be secure or error free
</pre>
</body>
</html>

--------------020906010105070404080509--



More information about the mapserver-users mailing list