Example #1
0
int
main(){
  simplet_map_t *map;
  if(!(map = simplet_map_new()))
    exit(1);

  simplet_map_set_slippy(map, 0, 0, 0);
  simplet_map_set_size(map, 1000, 1000);
  simplet_map_set_bgcolor(map, "#ddeeff");

  simplet_layer_t *layer   = simplet_map_add_layer(map, "../data/ne_10m_admin_0_countries.shp");
  simplet_filter_t *filter = simplet_layer_add_filter(layer,  "SELECT * from 'ne_10m_admin_0_countries'");
  simplet_filter_add_style(filter, "stroke", "#226688");
  simplet_filter_add_style(filter, "line-join", "round");
  simplet_filter_add_style(filter, "weight", "3");

  simplet_filter_t *filter2 = simplet_layer_add_filter(layer, "SELECT * from 'ne_10m_admin_0_countries'");
  simplet_filter_add_style(filter2, "weight", "0.5");
  simplet_filter_add_style(filter2, "fill", "#d3e46f");
  simplet_filter_add_style(filter2, "stroke", "#ffffff");
  simplet_filter_add_style(filter2, "line-join", "round");

  simplet_filter_add_style(filter2, "text-field", "NAME");
  simplet_filter_add_style(filter2, "font", "Lucida Grande, Regular 8");
  simplet_filter_add_style(filter2, "color", "#444444ff");
  simplet_filter_add_style(filter2, "text-stroke-color", "#ffffffcc");
  simplet_filter_add_style(filter2, "text-stroke-weight", "2");
  simplet_filter_add_style(filter2, "letter-spacing", "1");

  if(simplet_map_is_valid(map))
    simplet_map_render_to_png(map, "./out.png");
  simplet_map_free(map);
}
Example #2
0
void
test_projection(){
  simplet_map_t *map;
  assert((map = build_map()));
  simplet_map_set_srs(map, "+proj=aea +lat_1=27.5 +lat_2=35 +lat_0=18 +lon_0=-100 +x_0=1500000 +y_0=6000000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs +over");
  simplet_map_set_bounds(map, -3410023.644683, 12407191.9541633, 5198986.57554026, 6500142.362205);
  assert(simplet_map_is_valid(map));
  simplet_map_render_to_png(map, "./projection.png");
  assert(SIMPLET_OK == simplet_map_get_status(map));
  simplet_map_free(map);
}
Example #3
0
void
test_many_layers(){
  simplet_map_t *map;
  assert((map = build_map()));
  assert(simplet_map_is_valid(map));
  simplet_layer_t  *layer  = simplet_map_add_layer(map,
      "./data/ne_10m_admin_0_countries.shp");
  simplet_query_t *query = simplet_layer_add_query(layer,
      "SELECT * from 'ne_10m_admin_0_countries' where SOV_A3 = 'US1'");
  simplet_query_add_style(query, "fill", "#cc0000dd");
  simplet_map_render_to_png(map, "./layers.png");
  assert(SIMPLET_OK == simplet_map_get_status(map));
  simplet_map_free(map);
}
Example #4
0
void
test_many_queries(){
  simplet_map_t *map;
  assert((map = build_map()));
  assert(simplet_map_is_valid(map));
  simplet_query_t *query = simplet_layer_add_query(
      (simplet_layer_t *) simplet_list_get(map->layers, simplet_list_get_length(map->layers) - 1),
      "SELECT * from 'ne_10m_admin_0_countries' where SOV_A3 = 'US1'");

  simplet_query_add_style(query, "weight", "1");
  simplet_query_add_style(query, "stroke", "#00cc00dd");
  simplet_query_add_style(query, "fill",   "#cc0000");
  simplet_query_add_style(query, "blend",  "multiply");

  simplet_map_render_to_png(map, "./queries.png");
  assert(SIMPLET_OK == simplet_map_get_status(map));

  simplet_map_free(map);
}
Example #5
0
int main() {
  CPLSetConfigOption("CPL_DEBUG", "ON");

  simplet_map_t *map;
  if (!(map = simplet_map_new())) exit(1);

  simplet_map_set_slippy(map, 0, 0, 0);
  simplet_map_set_size(map, 1000, 1000);
  simplet_map_set_bgcolor(map, "#ddeeff");

  simplet_vector_layer_t *layer =
      simplet_map_add_vector_layer(map, "./data/ne_10m_admin_0_countries.shp");
  simplet_query_t *query = simplet_vector_layer_add_query(
      layer, "SELECT * from ne_10m_admin_0_countries");
  simplet_query_add_style(query, "stroke", "#226688");
  simplet_query_add_style(query, "line-join", "round");
  simplet_query_add_style(query, "weight", "3");

  simplet_query_t *query2 = simplet_vector_layer_add_query(
      layer, "SELECT * from ne_10m_admin_0_countries");
  simplet_query_add_style(query, "blend", "over");

  simplet_query_add_style(query2, "weight", "0.5");
  simplet_query_add_style(query2, "fill", "#d3e46f");
  simplet_query_add_style(query2, "stroke", "#ffffff");
  simplet_query_add_style(query2, "line-join", "round");

  simplet_query_add_style(query2, "text-field", "NAME");
  simplet_query_add_style(query2, "font", "Lucida Grande, Regular 8");
  simplet_query_add_style(query2, "color", "#444444ff");
  simplet_query_add_style(query2, "text-stroke-color", "#ffffffcc");
  simplet_query_add_style(query2, "text-stroke-weight", "2");
  simplet_query_add_style(query2, "letter-spacing", "1");

  simplet_map_add_raster_layer(map, "./data/loss_1932_2010.tif");

  if (simplet_map_is_valid(map)) simplet_map_render_to_png(map, "./out.png");

  simplet_map_free(map);
}