mirror of
https://github.com/systemed/tilemaker
synced 2025-02-21 13:24:09 +01:00

Described at https://stevage.github.io/ndgeojson/; each feature is given its own line, rather than being wrapped in a FeatureCollection.
49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
/*! \file */
|
|
#ifndef _GEOJSON_PROCESSOR_H
|
|
#define _GEOJSON_PROCESSOR_H
|
|
|
|
#include <unordered_map>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <map>
|
|
#include "geom.h"
|
|
#include "output_object.h"
|
|
#include "osm_lua_processing.h"
|
|
#include "attribute_store.h"
|
|
|
|
class GeoJSONProcessor {
|
|
|
|
public:
|
|
GeoJSONProcessor(Box &clippingBox,
|
|
uint threadNum,
|
|
class ShpMemTiles &shpMemTiles,
|
|
OsmLuaProcessing &osmLuaProcessing) :
|
|
clippingBox(clippingBox), threadNum(threadNum),
|
|
shpMemTiles(shpMemTiles), osmLuaProcessing(osmLuaProcessing)
|
|
{}
|
|
|
|
void read(class LayerDef &layer, uint layerNum);
|
|
|
|
private:
|
|
Box clippingBox;
|
|
unsigned threadNum;
|
|
ShpMemTiles &shpMemTiles;
|
|
OsmLuaProcessing &osmLuaProcessing;
|
|
std::mutex attributeMutex;
|
|
|
|
void readFeatureCollection(class LayerDef &layer, uint layerNum);
|
|
void readFeatureLines(class LayerDef &layer, uint layerNum);
|
|
|
|
template <bool Flag, typename T>
|
|
void processFeature(rapidjson::GenericObject<Flag, T> feature, class LayerDef &layer, uint layerNum);
|
|
|
|
template <bool Flag, typename T>
|
|
Polygon polygonFromGeoJSONArray(const rapidjson::GenericArray<Flag, T> &coords);
|
|
|
|
template <bool Flag, typename T>
|
|
std::vector<Point> pointsFromGeoJSONArray(const rapidjson::GenericArray<Flag, T> &arr);
|
|
|
|
AttributeIndex readProperties(const rapidjson::Value &pr, bool &hasName, std::string &name, LayerDef &layer, unsigned &minzoom);
|
|
};
|
|
|
|
#endif //_GEOJSON_PROCESSOR_H
|