Example #1
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 #2
0
void
test_bunk(){
  simplet_map_t *map;
  assert((map = simplet_map_new()));
  simplet_map_set_srs(map, "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs");
  simplet_map_set_size(map, 256, 256);
  simplet_map_set_bounds(map, -74.043825, 40.570771, -73.855660, 40.739255);
  simplet_layer_t  *layer  = simplet_map_add_layer(map, "./data/tl_2010_36047_roads.shp");
  simplet_layer_add_query(layer, "SELECT * from 'tl_2010_36047_roads_bunk'");
  simplet_map_render_to_png(map, "./bunk.png");
  assert(SIMPLET_OK != simplet_map_get_status(map));
  printf("ERROR AS EXPECTED: %s", simplet_map_status_to_string(map));
  simplet_map_free(map);
}
Example #3
0
int
main(){
  simplet_map_t *map = simplet_map_new();
  simplet_map_set_srs(map, "EPSG:3083");
  simplet_map_set_bgcolor(map, "#ffffff");
  simplet_map_set_bounds(map, -585080.885134, 6849466.721081, 4161303.603672, 9587780.816356);
  simplet_map_set_size(map, 423, 260);
  simplet_layer_t *layer = simplet_map_add_layer(map, "PG:dbname=simple_tiles_roads");
  simplet_query_t *query = simplet_layer_add_filter(layer, "select * from roads");
  simplet_query_add_style(query, "stroke", "#11111166");
  simplet_query_add_style(query, "line-join", "round");
  simplet_query_add_style(query, "weight", "0.1");

  simplet_map_render_to_png(map, "./out.png");
  simplet_map_free(map);
}
Example #4
0
void
test_lines(){
  simplet_map_t *map;
  assert((map = simplet_map_new()));
  simplet_map_set_srs(map, "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs");
  simplet_map_set_size(map, 256, 256);
  simplet_map_set_bounds(map, -74.043825, 40.570771, -73.855660, 40.739255);
  simplet_layer_t  *layer  = simplet_map_add_layer(map, "./data/tl_2010_36047_roads.shp");
  simplet_query_t *query = simplet_layer_add_query(layer,  "SELECT * from 'tl_2010_36047_roads'");
  simplet_query_add_style(query, "stroke",    "#000000ff");
	simplet_query_add_style(query, "line-cap",  "square");
  simplet_query_add_style(query, "line-join", "round");
  simplet_query_add_style(query, "weight",    "0.3");
  simplet_map_render_to_png(map, "./lines.png");
  assert(SIMPLET_OK == simplet_map_get_status(map));
  simplet_map_free(map);
}
Example #5
0
void
test_points(){
	simplet_map_t *map;
  assert((map = simplet_map_new()));
	simplet_map_set_srs(map, "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs");
  simplet_map_set_size(map, 256, 256);
  simplet_map_set_bounds(map, -92.889433, 42.491912,-86.763988, 47.080772);
  simplet_layer_t  *layer  = simplet_map_add_layer(map, "./data/ne_10m_populated_places.shp");
  simplet_query_t *query = simplet_layer_add_query(layer,  "SELECT * from 'ne_10m_populated_places'");
	simplet_query_add_style(query, "fill",   "#061F3799");
  simplet_query_add_style(query, "stroke", "#ffffff99");
  simplet_query_add_style(query, "weight", "0.1");
  simplet_query_add_style(query, "radius", "10");
	simplet_map_render_to_png(map, "./points.png");
  assert(SIMPLET_OK == simplet_map_get_status(map));
  simplet_map_free(map);
}
Example #6
0
simplet_map_t*
build_map(){
  simplet_map_t *map;
  assert((map = simplet_map_new()));
  simplet_map_set_srs(map, "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs");
  simplet_map_set_size(map, 256, 256);
  simplet_map_set_bounds(map,
      -179.231086, 17.831509, -100.859681, 71.441059);
  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'");
  simplet_query_add_style(query, "line-cap",  "square");
  simplet_query_add_style(query, "line-join", "round");
  simplet_query_add_style(query, "fill",      "#061F3799");
  simplet_query_add_style(query, "seamless",  "true");
  return map;
}
Example #7
0
void
test_holes(){
  simplet_map_t *map;
  assert((map = simplet_map_new()));
  simplet_map_set_srs(map, "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs");
  simplet_map_set_size(map, 256, 256);
  simplet_map_set_bounds(map, -92.889433, 42.491912,-86.763988, 47.080772);
  simplet_map_add_layer(map, "./data/tl_2010_55_cd108.shp");
  simplet_query_t *query = simplet_layer_add_query(
      (simplet_layer_t *) simplet_list_tail(map->layers),
      "SELECT * from 'tl_2010_55_cd108'");
  simplet_query_add_style(query, "line-cap",  "square");
  simplet_query_add_style(query, "line-join", "round");
  simplet_query_add_style(query, "fill",      "#061F3799");
  simplet_query_add_style(query, "stroke",    "#ffffff99");
  simplet_query_add_style(query, "weight",    "0.1");
  simplet_map_render_to_png(map, "./holes.png");
  assert(SIMPLET_OK == simplet_map_get_status(map));
  simplet_map_free(map);
}