LineString类型GEOS_LINESTRING
double line[] = {-100.0,0.0, 100.0,0.0};
GEOSCoordSequence* seq = GEOSCoordSeq_copyFromBuffer( line, 2, 0, 0);
GEOSGeometry* p1= GEOSGeom_createLineString(seq);
GEOSGeometry* p2= GEOSGeomFromWKT("LINESTRING (100 -100.0,100.0 100.0)");
//判断直线是否相交,相交返回1,否则为0
int n = GEOSIntersects(p1,p2);
//求交点
GEOSGeometry*p3= GEOSIntersection(p1,p1);
//是否闭合
GEOSisClosed(p1)
//获取长度
GEOSGeomGetLength(p2,&dis);
//遍历点
double x,y;
int points = GEOSGeomGetNumPoints(p1);
for (int i=0;i<points;i++)
{
GEOSGeometry* p = GEOSGeomGetPointN(p1,i);
GEOSGeomGetX(p, &x);
GEOSGeomGetY(p, &y);
GEOSGeom_destroy(p);
}
//获取首尾点坐标
GEOSGeometry* p =GEOSGeomGetStartPoint(p1);
GEOSGeometry* p =GEOSGeomGetEndPoint(p1);