mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
40 lines
836 B
C++
40 lines
836 B
C++
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <vector>
|
|
|
|
extern "C" {
|
|
#include "jsonpull/jsonpull.h"
|
|
}
|
|
|
|
#include "read_json.hpp"
|
|
#include "geometry.hpp"
|
|
|
|
const char *geometry_names[GEOM_TYPES] = {
|
|
"Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon",
|
|
};
|
|
|
|
int geometry_within[GEOM_TYPES] = {
|
|
-1, /* point */
|
|
GEOM_POINT, /* multipoint */
|
|
GEOM_POINT, /* linestring */
|
|
GEOM_LINESTRING, /* multilinestring */
|
|
GEOM_LINESTRING, /* polygon */
|
|
GEOM_POLYGON, /* multipolygon */
|
|
};
|
|
|
|
int mb_geometry[GEOM_TYPES] = {
|
|
VT_POINT, VT_POINT, VT_LINE, VT_LINE, VT_POLYGON, VT_POLYGON,
|
|
};
|
|
|
|
void json_context(json_object *j) {
|
|
char *s = json_stringify(j);
|
|
|
|
if (strlen(s) >= 500) {
|
|
sprintf(s + 497, "...");
|
|
}
|
|
|
|
fprintf(stderr, "In JSON object %s\n", s);
|
|
free(s); // stringify
|
|
}
|