static char *
asgeojson_poly(GEOSGeom poly, char *srs, bbox3D *bbox, int precision)
{
    char *output;
    int size;

    size = asgeojson_poly_size(poly, srs, bbox, precision);
    output = GDKmalloc(size);
    asgeojson_poly_buf(poly, srs, output, bbox, precision);

    return output;
}
Esempio n. 2
0
static char *
asgeojson_poly(const LWPOLY *poly, char *srs, GBOX *bbox, int precision)
{
	char *output;
	int size;

	size = asgeojson_poly_size(poly, srs, bbox, precision);
	output = lwalloc(size);
	asgeojson_poly_buf(poly, srs, output, bbox, precision);

	return output;
}
    static size_t
asgeojson_geom_size(GEOSGeom geom, bbox3D *bbox, int precision)
{
    int type = GEOSGeomTypeId(geom)+1;
    size_t size = 0;

    switch (type)
    {
        case wkbPoint_mdb:
            size = asgeojson_point_size(geom, NULL, bbox, precision);
            break;

        case wkbLineString_mdb:
            size = asgeojson_line_size(geom, NULL, bbox, precision);
            break;

        case wkbPolygon_mdb:
            size = asgeojson_poly_size(geom, NULL, bbox, precision);
            break;

        case wkbMultiPoint_mdb:
            size = asgeojson_multipoint_size(geom, NULL, bbox, precision);
            break;

        case wkbMultiLineString_mdb:
            size = asgeojson_multiline_size(geom, NULL, bbox, precision);
            break;

        case wkbMultiPolygon_mdb:
            size = asgeojson_multipolygon_size(geom, NULL, bbox, precision);
            break;

        default:
            assert(0);
            size = 0;
    }

    return size;
}
Esempio n. 4
0
static size_t
asgeojson_geom_size(const LWGEOM *geom, GBOX *bbox, int precision)
{
	int type = geom->type;
	size_t size = 0;

	switch (type)
	{
	case POINTTYPE:
		size = asgeojson_point_size((LWPOINT*)geom, NULL, bbox, precision);
		break;

	case LINETYPE:
		size = asgeojson_line_size((LWLINE*)geom, NULL, bbox, precision);
		break;

	case POLYGONTYPE:
		size = asgeojson_poly_size((LWPOLY*)geom, NULL, bbox, precision);
		break;

	case MULTIPOINTTYPE:
		size = asgeojson_multipoint_size((LWMPOINT*)geom, NULL, bbox, precision);
		break;

	case MULTILINETYPE:
		size = asgeojson_multiline_size((LWMLINE*)geom, NULL, bbox, precision);
		break;

	case MULTIPOLYGONTYPE:
		size = asgeojson_multipolygon_size((LWMPOLY*)geom, NULL, bbox, precision);
		break;

	default:
		lwerror("GeoJson: geometry not supported.");
	}

	return size;
}