コード例 #1
0
ファイル: lwout_geojson.c プロジェクト: NianYue/pipelinedb
static size_t
asgeojson_multipolygon_size(const LWMPOLY *mpoly, char *srs, GBOX *bbox, int precision)
{
	LWPOLY *poly;
	int size;
	int i, j;

	size = sizeof("{'type':'MultiPolygon',");
	if (srs) size += asgeojson_srs_size(srs);
	if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(mpoly->flags), precision);
	size += sizeof("'coordinates':[]}");

	for (i=0; i < mpoly->ngeoms; i++)
	{
		poly = mpoly->geoms[i];
		for (j=0 ; j <poly->nrings ; j++)
		{
			size += pointArray_geojson_size(poly->rings[j], precision);
			size += sizeof("[]");
		}
		size += sizeof("[]");
	}
	size += sizeof(",") * i;
	size += sizeof("]}");

	return size;
}
コード例 #2
0
    static size_t
asgeojson_multipolygon_size(GEOSGeom mpoly, char *srs, bbox3D *bbox, int precision)
{
    GEOSGeom poly;
    int size;
    int i, j, ngeoms = GEOSGetNumGeometries(mpoly);

    size = sizeof("{'type':'MultiPolygon',");
    if (srs) size += asgeojson_srs_size(srs);
    if (bbox) size += asgeojson_bbox_size(GEOS_getWKBOutputDims(mpoly) == 3, precision);
    size += sizeof("'coordinates':[]}");

    for (i=0; i < ngeoms; i++)
    {
        int nrings;
        poly = (GEOSGeom ) GEOSGetGeometryN(mpoly, i);
        nrings = GEOSGetNumInteriorRings(poly);
        for (j=0 ; j <nrings ; j++)
        {
            size += points_geojson_size(*(GEOSGeom*)GEOSGetInteriorRingN(poly, j), precision);
            size += sizeof("[]");
        }
        size += sizeof("[]");
    }
    size += sizeof(",") * i;
    size += sizeof("]}");

    return size;
}
コード例 #3
0
    static size_t
asgeojson_line_size(GEOSGeom line, char *srs, bbox3D *bbox, int precision)
{
    int size;

    size = sizeof("{'type':'LineString',");
    if (srs) size += asgeojson_srs_size(srs);
    if (bbox) size += asgeojson_bbox_size(GEOS_getWKBOutputDims(line) == 3, precision);
    size += sizeof("'coordinates':[]}");
    size += points_geojson_size(line, precision);

    return size;
}
コード例 #4
0
ファイル: lwout_geojson.c プロジェクト: NianYue/pipelinedb
static size_t
asgeojson_line_size(const LWLINE *line, char *srs, GBOX *bbox, int precision)
{
	int size;

	size = sizeof("{'type':'LineString',");
	if (srs) size += asgeojson_srs_size(srs);
	if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(line->flags), precision);
	size += sizeof("'coordinates':[]}");
	size += pointArray_geojson_size(line->points, precision);

	return size;
}
コード例 #5
0
ファイル: lwout_geojson.c プロジェクト: JeremyGrosser/postgis
static size_t
asgeojson_point_size(const LWPOINT *point, char *srs, GBOX *bbox, int precision)
{
	int size;

	size = pointArray_geojson_size(point->point, precision);
	size += sizeof("{'type':'Point',");
	size += sizeof("'coordinates':}");

	if (srs) size += asgeojson_srs_size(srs);
	if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(point->flags), precision);

	return size;
}
コード例 #6
0
    static size_t
asgeojson_point_size(GEOSGeom point, char *srs, bbox3D *bbox, int precision)
{
    int size;

    size = points_geojson_size(point, precision);
    size += sizeof("{'type':'Point',");
    size += sizeof("'coordinates':}");

    if ( GEOSisEmpty(point) == 1 )
        size += 2; /* [] */

    if (srs) size += asgeojson_srs_size(srs);
    if (bbox) size += asgeojson_bbox_size(GEOS_getWKBOutputDims(point) == 3, precision);

    return size;
}
コード例 #7
0
    static size_t
asgeojson_poly_size(GEOSGeom poly, char *srs, bbox3D *bbox, int precision)
{
    size_t size;
    int i, nrings = GEOSGetNumInteriorRings(poly);

    size = sizeof("{\"type\":\"Polygon\",");
    if (srs) size += asgeojson_srs_size(srs);
    if (bbox) size += asgeojson_bbox_size(GEOS_getWKBOutputDims(poly) == 3, precision);
    size += sizeof("\"coordinates\":[");
    for (i=0; i<nrings; i++)
    {
        size += points_geojson_size(*(GEOSGeom*)GEOSGetInteriorRingN(poly, i), precision);
        size += sizeof("[]");
    }
    size += sizeof(",") * i;
    size += sizeof("]}");

    return size;
}
コード例 #8
0
ファイル: lwout_geojson.c プロジェクト: NianYue/pipelinedb
static size_t
asgeojson_poly_size(const LWPOLY *poly, char *srs, GBOX *bbox, int precision)
{
	size_t size;
	int i;

	size = sizeof("{\"type\":\"Polygon\",");
	if (srs) size += asgeojson_srs_size(srs);
	if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(poly->flags), precision);
	size += sizeof("\"coordinates\":[");
	for (i=0, size=0; i<poly->nrings; i++)
	{
		size += pointArray_geojson_size(poly->rings[i], precision);
		size += sizeof("[]");
	}
	size += sizeof(",") * i;
	size += sizeof("]}");

	return size;
}
コード例 #9
0
    static size_t
asgeojson_multipoint_size(GEOSGeom mpoint, char *srs, bbox3D *bbox, int precision)
{
    GEOSGeom  point;
    int size;
    int i, ngeoms = GEOSGetNumGeometries(mpoint);

    size = sizeof("{'type':'MultiPoint',");
    if (srs) size += asgeojson_srs_size(srs);
    if (bbox) size += asgeojson_bbox_size(GEOS_getWKBOutputDims(mpoint) == 3, precision);
    size += sizeof("'coordinates':[]}");

    for (i=0; i<ngeoms; i++)
    {
        point = (GEOSGeom ) GEOSGetGeometryN(mpoint, i);
        size += points_geojson_size(point, precision);
    }
    size += sizeof(",") * i;

    return size;
}
コード例 #10
0
ファイル: lwout_geojson.c プロジェクト: NianYue/pipelinedb
static size_t
asgeojson_multipoint_size(const LWMPOINT *mpoint, char *srs, GBOX *bbox, int precision)
{
	LWPOINT * point;
	int size;
	int i;

	size = sizeof("{'type':'MultiPoint',");
	if (srs) size += asgeojson_srs_size(srs);
	if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(mpoint->flags), precision);
	size += sizeof("'coordinates':[]}");

	for (i=0; i<mpoint->ngeoms; i++)
	{
		point = mpoint->geoms[i];
		size += pointArray_geojson_size(point->point, precision);
	}
	size += sizeof(",") * i;

	return size;
}
コード例 #11
0
    static size_t
asgeojson_collection_size(GEOSGeom col, char *srs, bbox3D *bbox, int precision)
{
    int i,ngeoms = GEOSGetNumGeometries(col);
    int size;
    GEOSGeom subgeom;

    size = sizeof("{'type':'GeometryCollection',");
    if (srs) size += asgeojson_srs_size(srs);
    if (bbox) size += asgeojson_bbox_size(GEOS_getWKBOutputDims(col) == 3, precision);
    size += sizeof("'geometries':");

    for (i=0; i<ngeoms; i++)
    {
        subgeom = (GEOSGeom ) GEOSGetGeometryN(col, i);
        size += asgeojson_geom_size(subgeom, NULL, precision);
    }
    size += sizeof(",") * i;
    size += sizeof("]}");

    return size;
}
コード例 #12
0
    static size_t
asgeojson_multiline_size(GEOSGeom mline, char *srs, bbox3D *bbox, int precision)
{
    GEOSGeom  line;
    int size;
    int i, ngeoms = GEOSGetNumGeometries(mline);

    size = sizeof("{'type':'MultiLineString',");
    if (srs) size += asgeojson_srs_size(srs);
    if (bbox) size += asgeojson_bbox_size(GEOS_getWKBOutputDims(mline) == 3, precision);
    size += sizeof("'coordinates':[]}");

    for (i=0 ; i<ngeoms; i++)
    {
        line = (GEOSGeom ) GEOSGetGeometryN(mline, i);
        size += points_geojson_size(line, precision);
        size += sizeof("[]");
    }
    size += sizeof(",") * i;

    return size;
}
コード例 #13
0
ファイル: lwout_geojson.c プロジェクト: NianYue/pipelinedb
static size_t
asgeojson_collection_size(const LWCOLLECTION *col, char *srs, GBOX *bbox, int precision)
{
	int i;
	int size;
	LWGEOM *subgeom;

	size = sizeof("{'type':'GeometryCollection',");
	if (srs) size += asgeojson_srs_size(srs);
	if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(col->flags), precision);
	size += sizeof("'geometries':");

	for (i=0; i<col->ngeoms; i++)
	{
		subgeom = col->geoms[i];
		size += asgeojson_geom_size(subgeom, NULL, precision);
	}
	size += sizeof(",") * i;
	size += sizeof("]}");

	return size;
}
コード例 #14
0
ファイル: lwout_geojson.c プロジェクト: NianYue/pipelinedb
static size_t
asgeojson_multiline_size(const LWMLINE *mline, char *srs, GBOX *bbox, int precision)
{
	LWLINE * line;
	int size;
	int i;

	size = sizeof("{'type':'MultiLineString',");
	if (srs) size += asgeojson_srs_size(srs);
	if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(mline->flags), precision);
	size += sizeof("'coordinates':[]}");

	for (i=0 ; i<mline->ngeoms; i++)
	{
		line = mline->geoms[i];
		size += pointArray_geojson_size(line->points, precision);
		size += sizeof("[]");
	}
	size += sizeof(",") * i;

	return size;
}