[geos-devel] Wrong values in GEOSCoordSeq

Giacomo Piva piva at meeo.it
Fri Aug 7 06:22:34 EDT 2009


I'm sorry, I forgot the initGEOS() call.
I'm a donkey ;)

> Hi All,
>
> I'm using for the first time GEOS library in a (ANSI) C application.
> I need to get the intersection of two polygons.
> Looking at the geos.h file (for C reference) I'm trying to get the 
> intersection in this way:
>
>    GEOSCoordSeq coordseq = NULL;
>    GEOSGeom area1 = NULL, shell = NULL, intersection = NULL;
>    GEOSGeom holes_ptr[1];
>
>    coordseq = (GEOSCoordSeq) GEOSCoordSeq_create(5, 2);    // 5 points 
> 2 dimensions
>
>    GEOSCoordSeq_setX(coordseq, 0, Lon_UL);    //Coord upper left
>    GEOSCoordSeq_setY(coordseq, 0, Lat_UL);
>    GEOSCoordSeq_setX(coordseq, 1, Lon_LR);    //Coord upper right
>    GEOSCoordSeq_setY(coordseq, 1, Lat_UL);
>    GEOSCoordSeq_setX(coordseq, 2, Lon_LR);    //Coord lower right
>    GEOSCoordSeq_setY(coordseq, 2, Lat_LR);
>    GEOSCoordSeq_setX(coordseq, 3, Lon_UL);    //Coord lower left
>    GEOSCoordSeq_setY(coordseq, 3, Lat_LR);
>    GEOSCoordSeq_setX(coordseq, 4, Lon_UL);    //Coord upper left (again)
>    GEOSCoordSeq_setY(coordseq, 4, Lat_UL);
>
> where Lon_* and Lat_* are float values.
>
> First of all, I'm trying to see if the value in the coordseq are 
> stored properly so...
>
> I print the inserted value: 
> printf("%f \n", Lon_UL);
> ...
>
> And the stored values:
>
> for(...
>    GEOSCoordSeq_getX(coordseq, i, &pippo);
>    printf("[%d] %f ", i, pippo);
>
>
> Finally, I get different values:
> At runtime:
>
> -131.799500
>
> [0] -0.000000 -0.000000
> [1] -0.000000 -0.000000
> [2] -0.000000 -0.000000
> [3] -0.000000 -0.000000
> [4] -0.000000 -0.000000
>
>
> I'm sorry for this stupid question but... what it's wrong?
> Thanks to all.
>
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
>
>


-- 
Giacomo Piva

MEEO S.r.l.
Via Saragat 9
I-44122 Ferrara, Italy
Tel: +39 0532 1861501
Fax: +39 0532 1861637
http://www.meeo.it

========================================
"ATTENZIONE:le informazioni contenute in questo messaggio sono
da considerarsi confidenziali ed il loro utilizzo è riservato unicamente
al destinatario sopra indicato. Chi dovesse ricevere questo messaggio
per errore è tenuto ad informare il mittente ed a rimuoverlo
definitivamente da ogni supporto elettronico o cartaceo."

"WARNING:This message contains confidential and/or proprietary
information which may be subject to privilege or immunity and which
is intended for use of its addressee only. Should you receive this
message in error, you are kindly requested to inform the sender and
to definitively remove it from any paper or electronic format." 



More information about the geos-devel mailing list