<div dir="ltr"><span style="font-size:12.800000190734863px">Hello all</span><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">I'm trying to create some images with m.nviz.image, but all I get as output is a 11 byte ppm...</div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">Some of the options are quite puzzling in terms of mixing units:</div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px"><div>position=x,y</div><div>Viewpoint position (x,y model coordinates)</div><div><br></div><div><div>height=value</div><div>Viewpoint height (in map units)</div></div><div><br></div><div><div>focus=x,y,z</div><div>Focus to point on surface (from SW corner in map units)</div></div><div><br></div><div>So I have to convert my position coordinates from map units (say meters in UTM) to 0-1, I can use height in meters, and also need to do some math to get the position of the focus point in meters from the SW corner... </div><div><br></div><div>Also, regardless of the output size, all I get is an unreadable ppm with 11 bytes. With format=tif, I get an error creating the file (TIFFScanlineSize64: Computed scanline size is zero.).</div><div><br></div><div>Opening the ppm file into a text editor, I see that all that was written was the header, and that the image size was 0,0:</div><div><br></div><div><div>P6</div><div>0 0</div><div>255</div></div><div><br></div><div>navigating trough the code, I see that m.nviz.image calls GS_write_ppm to write the file, which is in lib/ogsf/gsd_img_ppm.c:</div><div><br></div><div><div><br></div><div>int GS_write_ppm(const char *name)</div><div>{</div><div> unsigned int x;</div><div> int y;</div><div> unsigned int xsize, ysize;</div><div> FILE *fp;</div><div> unsigned char *pixbuf;</div><div><br></div><div> gsd_getimage(&pixbuf, &xsize, &ysize);</div><div><br></div><div> if (NULL == (fp = fopen(name, "w"))) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>G_warning(_("Unable to open file <%s> for writing"), name);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>return (1);</div><div> }</div><div><br></div><div> fprintf(fp, "P6\n%d %d\n255\n", xsize, ysize);</div><div><br></div><div> for (y = ysize - 1; y >= 0; y--) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>for (x = 0; x < xsize; x++) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> unsigned char r = pixbuf[(y * xsize + x) * 4 + 0];</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> unsigned char g = pixbuf[(y * xsize + x) * 4 + 1];</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> unsigned char b = pixbuf[(y * xsize + x) * 4 + 2];</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> fputc((int)r, fp);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> fputc((int)g, fp);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> fputc((int)b, fp);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>}</div><div><br></div><div> }</div><div> G_free(pixbuf);</div><div> fclose(fp);</div><div><br></div><div> return (0);</div><div>}</div></div><div><br></div><div><br></div><div>GS_write_ppm calls gsd_getimage to get the actual image data and size.<br></div><div><br></div><div>So it seems to me that gsd_getimage is not getting the image?</div><div><br></div><div><br></div><div><br></div><div><br></div><div>The goal is to reproduce a nadir-looking aerial view (airplane, UAV).</div><div><br></div><div>Is this even possible?</div><div><br></div><div>thanks</div><div><br></div><div><br></div><div><br></div><div><br></div></div><div><br></div>-- <br><div class="gmail-m_5197134786683010382gmail_signature"><div dir="ltr">Prof. Carlos Henrique Grohmann<br>Institute of Energy and Environment - Univ. of São Paulo, Brazil<div>- Digital Terrain Analysis | GIS | Remote Sensing - </div><div><br></div><div><a href="http://carlosgrohmann.com/" target="_blank">http://carlosgrohmann.com</a></div><div><a href="http://orcid.org/0000-0001-5073-5572" style="font-size:13px;color:rgb(17,85,204)" target="_blank">http://orcid.org/0000-0001-<wbr>5073-5572</a><br><div>________________<br>Can’t stop the signal.</div></div></div></div>
</div>