<div dir="ltr">Ok, I found the error. I wasn't doing initGEOS</div><div class="gmail_extra"><br><div class="gmail_quote">On 8 February 2018 at 15:50, Gabriel Furstenheim Milerud <span dir="ltr"><<a href="mailto:furstenheim@gmail.com" target="_blank">furstenheim@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<br>I'm trying to use geos_c but I'm getting null geometry.<br><br>I installed the dependency from libgeos-dev.<br><br>I've been following <a href="https://github.com/OSGeo/geos/blob/master/tests/geostest/geostest.c" target="_blank">https://github.com/OSGeo/geos/<wbr>blob/master/tests/geostest/<wbr>geostest.c</a><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>#include <stdio.h><br>#include <stdlib.h><br>#include "geos_c.h"<br>#define MAXWKTLEN 1047551<br></blockquote><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">static char wkt[MAXWKTLEN]; </blockquote><div>  // In a.wkt the same example as the test </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">input = fopen("./a.wkt", "r");<br>if ( ! input ) { perror("fopen"); exit(1); }<br>size = fread(wkt, 1, MAXWKTLEN-1, input);<br>fclose(input);<br>if ( ! size ) { perror("fread"); exit(1); }<br>if ( size == MAXWKTLEN-1 ) { perror("WKT input too big!"); exit(1); }<br>wkt[size] = '\0'; /* ensure it is null terminated */<br>g1 = GEOSGeomFromWKT(wkt);<br>printf("g1 generated\n");<br>ptr = GEOSGeomToWKT(g1);<br>printf("Origin (WKT): %s.\n", wkt2);<br>if (!g1) printf("Pointer is null\n");<br>printf("Input (WKT): %s.\n", ptr);</blockquote><br>Both g1 and ptr are null.What might I be doing incorrectly?<br><br><br>Thanks a lot.<div><font color="#000000" face="DejaVu Sans Mono"><span style="font-size:12px"><br></span></font></div></div>
</blockquote></div><br></div>