Ok, I found the error. I wasn't doing initGEOS On 8 February 2018 at 15:50, Gabriel Furstenheim Milerud < furstenh...@gmail.com> wrote:
> Hello, > I'm trying to use geos_c but I'm getting null geometry. > > I installed the dependency from libgeos-dev. > > I've been following https://github.com/OSGeo/geos/ > blob/master/tests/geostest/geostest.c > >> >> #include <stdio.h> >> #include <stdlib.h> >> #include "geos_c.h" >> #define MAXWKTLEN 1047551 >> > > > >> static char wkt[MAXWKTLEN]; > > // In a.wkt the same example as the test > >> input = fopen("./a.wkt", "r"); >> if ( ! input ) { perror("fopen"); exit(1); } >> size = fread(wkt, 1, MAXWKTLEN-1, input); >> fclose(input); >> if ( ! size ) { perror("fread"); exit(1); } >> if ( size == MAXWKTLEN-1 ) { perror("WKT input too big!"); exit(1); } >> wkt[size] = '\0'; /* ensure it is null terminated */ >> g1 = GEOSGeomFromWKT(wkt); >> printf("g1 generated\n"); >> ptr = GEOSGeomToWKT(g1); >> printf("Origin (WKT): %s.\n", wkt2); >> if (!g1) printf("Pointer is null\n"); >> printf("Input (WKT): %s.\n", ptr); > > > Both g1 and ptr are null.What might I be doing incorrectly? > > > Thanks a lot. > >
_______________________________________________ geos-devel mailing list geos-devel@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/geos-devel