navit  0.5.3-trunk
osm_protobuf.c File Reference
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <unistd.h>
#include <time.h>
#include <zlib.h>
#include "maptool.h"
#include "debug.h"
#include "linguistics.h"
#include "file.h"
#include "fileformat.pb-c.h"
#include "osmformat.pb-c.h"

Macros

#define MAX_HEADER_LENGTH   1024 * 64
 
#define MAX_BLOB_LENGTH   1024 * 1024 * 32
 
#define SANITY_CHECK_LENGTH(length, max_length)
 

Functions

static OSMPBF__BlobHeader * read_header (FILE *f)
 
static OSMPBF__Blob * read_blob (OSMPBF__BlobHeader *header, FILE *f, unsigned char *buffer)
 
static unsigned char * uncompress_blob (OSMPBF__Blob *blob)
 
static int get_string (char *buffer, int buffer_size, OSMPBF__PrimitiveBlock *primitive_block, int id, int escape)
 
static void process_osmheader (OSMPBF__Blob *blob, unsigned char *data)
 
static void process_tag (OSMPBF__PrimitiveBlock *primitive_block, int key, int val)
 
static void process_dense (OSMPBF__PrimitiveBlock *primitive_block, OSMPBF__DenseNodes *dense, struct maptool_osm *osm)
 
static void process_way (OSMPBF__PrimitiveBlock *primitive_block, OSMPBF__Way *way, struct maptool_osm *osm)
 
static void process_relation (OSMPBF__PrimitiveBlock *primitive_block, OSMPBF__Relation *relation, struct maptool_osm *osm)
 
static void process_osmdata (OSMPBF__Blob *blob, unsigned char *data, struct maptool_osm *osm)
 
int map_collect_data_osm_protobuf (FILE *in, struct maptool_osm *osm)
 

Variables

static double latlon_scale =10000000.0
 

Macro Definition Documentation

◆ MAX_BLOB_LENGTH

#define MAX_BLOB_LENGTH   1024 * 1024 * 32

◆ MAX_HEADER_LENGTH

#define MAX_HEADER_LENGTH   1024 * 64

◆ SANITY_CHECK_LENGTH

#define SANITY_CHECK_LENGTH (   length,
  max_length 
)
Value:
if (length > max_length){ \
fprintf(stderr,"Not a valid protobuf file. " \
"Invalid block size in input: %d, max is %d. \n", \
length, max_length); \
return NULL; \
}
int length
Definition: garmin_img.c:1

Function Documentation

◆ get_string()

static int get_string ( char *  buffer,
int  buffer_size,
OSMPBF__PrimitiveBlock *  primitive_block,
int  id,
int  escape 
)
static

References buffer_size, data, and p.

Referenced by process_relation(), and process_tag().

◆ map_collect_data_osm_protobuf()

int map_collect_data_osm_protobuf ( FILE *  in,
struct maptool_osm osm 
)

◆ process_dense()

static void process_dense ( OSMPBF__PrimitiveBlock *  primitive_block,
OSMPBF__DenseNodes *  dense,
struct maptool_osm osm 
)
static

◆ process_osmdata()

static void process_osmdata ( OSMPBF__Blob *  blob,
unsigned char *  data,
struct maptool_osm osm 
)
static

◆ process_osmheader()

static void process_osmheader ( OSMPBF__Blob *  blob,
unsigned char *  data 
)
static

References data.

Referenced by map_collect_data_osm_protobuf().

◆ process_relation()

static void process_relation ( OSMPBF__PrimitiveBlock *  primitive_block,
OSMPBF__Relation *  relation,
struct maptool_osm osm 
)
static

◆ process_tag()

static void process_tag ( OSMPBF__PrimitiveBlock *  primitive_block,
int  key,
int  val 
)
static

◆ process_way()

static void process_way ( OSMPBF__PrimitiveBlock *  primitive_block,
OSMPBF__Way *  way,
struct maptool_osm osm 
)
static

◆ read_blob()

static OSMPBF__Blob* read_blob ( OSMPBF__BlobHeader *  header,
FILE *  f,
unsigned char *  buffer 
)
static

◆ read_header()

static OSMPBF__BlobHeader* read_header ( FILE *  f)
static

◆ uncompress_blob()

static unsigned char* uncompress_blob ( OSMPBF__Blob *  blob)
static

Variable Documentation

◆ latlon_scale

double latlon_scale =10000000.0
static

Referenced by process_dense().