Example #1
0
mapcache_source* mapcache_source_mapserver_create(mapcache_context *ctx) {
   mapcache_source_mapserver *source = apr_pcalloc(ctx->pool, sizeof(mapcache_source_mapserver));
   if(!source) {
      ctx->set_error(ctx, 500, "failed to allocate mapserver source");
      return NULL;
   }
   mapcache_source_init(ctx, &(source->source));
   source->source.type = MAPCACHE_SOURCE_MAPSERVER;
   source->source.render_map = _mapcache_source_mapserver_render_map;
   source->source.configuration_check = _mapcache_source_mapserver_configuration_check;
   source->source.configuration_parse_xml = _mapcache_source_mapserver_configuration_parse_xml;
   source->source.query_info = _mapcache_source_mapserver_query;
   return (mapcache_source*)source;
}
Example #2
0
mapcache_source* mapcache_source_tms_create(mapcache_context *ctx)
{
    mapcache_source_tms *source = apr_pcalloc(ctx->pool, sizeof(mapcache_source_tms));
    if(!source) {
        ctx->set_error(ctx, 500, "failed to allocate tms source");
        return NULL;
    }
    mapcache_source_init(ctx, &(source->source));
    source->http = NULL;
    source->url = NULL;
    source->layer = NULL;
    source->flipy = FALSE;
    source->source.type = MAPCACHE_SOURCE_TMS;
    source->source.render_map = _mapcache_source_tms_render_map;
    source->source.configuration_check = _mapcache_source_tms_configuration_check;
    source->source.configuration_parse_xml = _mapcache_source_tms_configuration_parse_xml;
    source->source.query_info = _mapcache_source_tms_query;

    return (mapcache_source*)&source->source;
}
Example #3
0
mapcache_source* mapcache_source_gdal_create(mapcache_context *ctx)
{
#ifdef USE_GDAL
  GDALAllRegister();
  mapcache_source_gdal *source = apr_pcalloc(ctx->pool, sizeof(mapcache_source_gdal));
  if(!source) {
    ctx->set_error(ctx, MAPCACHE_ALLOC_ERROR, "failed to allocate gdal source");
    return NULL;
  }
  mapcache_source_init(ctx, &(source->source));
  source->source.type = MAPCACHE_SOURCE_GDAL;
  source->source.render_metatile = _mapcache_source_gdal_render_metatile;
  source->source.configuration_check = _mapcache_source_gdal_configuration_check;
  source->source.configuration_parse = _mapcache_source_gdal_configuration_parse;
  source->gdal_params = apr_table_make(ctx->pool,4);
  return (mapcache_source*)source;
#else
  ctx->set_error(ctx, 400, "failed to create gdal source, GDAL support is not compiled in this version");
  return NULL;
#endif
}