Skip to content

Commit

Permalink
Fixing threds, playing with config and improving vectore
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoRio42 committed Nov 8, 2024
1 parent e2dec73 commit 2055291
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/src/content/docs/guides/batch-mode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import GlossaryLink from "../../../components/GlossaryLink.astro";

If you want to generate a map for a large area, you might need to process several <GlossaryLink slug="lidar" /> files together. You can do so by passing the `--batch` flag to the `cassini` command.

```sh
```sh frame="none"
cassini --batch
```

You will need to put your <GlossaryLink slug="lidar" /> files in a directory named `in` at the root of the directory in which you are executing Cassini. The output tiles and the merged map will be put in a directory named `out`.

If you are not happy with the result (too few cliffs, too much green...), you can modify the configuration and re-generate the map while skipping the <GlossaryLink slug="lidar" /> preprocessing step (which is the most time consuming part) with the `--skip-lidar` flag. Check the [configuration reference](/reference/configuration-reference/) to learn more about all the configuration options.

```sh
```sh frame="none"
cassini --batch --skip-lidar
```
2 changes: 1 addition & 1 deletion docs/src/content/docs/guides/installation-and-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ cassini ./tile.laz
To update Cassini to the latest version, pull the latest [nicorio42/cassini](https://hub.docker.com/r/nicorio42/cassini) image:
```sh fram="none"
```sh frame="none"
docker pull nicorio42/cassini:latest
```
Expand Down
12 changes: 6 additions & 6 deletions docs/src/content/docs/reference/configuration-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ The number of points below which a one meter by one meter cell will be yellow ([
<p>

**Type:** `number`<br />
**Default:** `1.0`
**Default:** `0.2`

</p>

The number of points above which a one meter by one meter cell will be light green ([ISOM 406 Vegetation, slow running](https://omapwiki.orienteering.sport/symbols/406-vegetation-slow-running/)).

```json
{
"green_threshold_1": 1.0
"green_threshold_1": 0.2
}
```

Expand All @@ -50,15 +50,15 @@ The number of points above which a one meter by one meter cell will be light gre
<p>

**Type:** `number`<br />
**Default:** `2.0`
**Default:** `1.0`

</p>

The number of points above which a one meter by one meter cell will be medium green ([ISOM 408 Vegetation, walk](https://omapwiki.orienteering.sport/symbols/408-vegetation-walk/)).

```json
{
"green_threshold_2": 2.0
"green_threshold_2": 1.0
}
```

Expand All @@ -67,15 +67,15 @@ The number of points above which a one meter by one meter cell will be medium gr
<p>

**Type:** `number`<br />
**Default:** `3.0`
**Default:** `2.0`

</p>

The number of points above which a one meter by one meter cell will be dark green ([ISOM 410 Vegetation, fight](https://omapwiki.orienteering.sport/symbols/410-vegetation-fight/)).

```json
{
"green_threshold_3": 3.0
"green_threshold_3": 2.0
}
```

Expand Down
5 changes: 3 additions & 2 deletions src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ pub fn batch(number_of_threads: usize, skip_lidar: bool, skip_vector: bool) {

let tiles = get_tiles_with_neighbors();
let tiles_arc = Arc::new(tiles.clone());
let chunk_size = (tiles.len() + number_of_threads - 1) / number_of_threads;

if !skip_lidar {
let tiles_chunks: Vec<Vec<TileWithNeighbors>> = tiles_arc
.chunks(number_of_threads)
.chunks(chunk_size)
.map(|chunk| chunk.to_vec())
.collect();

Expand Down Expand Up @@ -57,7 +58,7 @@ pub fn batch(number_of_threads: usize, skip_lidar: bool, skip_vector: bool) {
}

let tiles_chunks: Vec<Vec<TileWithNeighbors>> = tiles_arc
.chunks(number_of_threads)
.chunks(chunk_size)
.map(|chunk| chunk.to_vec())
.collect();

Expand Down
6 changes: 3 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::{
};

const DEFAULT_YELLOW_THRESHOLD: f64 = 0.5; // Update the docs when modifying
const DEFAULT_GREEN_THRESHOLD_1: f64 = 1.0; // Update the docs when modifying
const DEFAULT_GREEN_THRESHOLD_2: f64 = 2.0; // Update the docs when modifying
const DEFAULT_GREEN_THRESHOLD_3: f64 = 3.0; // Update the docs when modifying
const DEFAULT_GREEN_THRESHOLD_1: f64 = 0.2; // Update the docs when modifying
const DEFAULT_GREEN_THRESHOLD_2: f64 = 1.0; // Update the docs when modifying
const DEFAULT_GREEN_THRESHOLD_3: f64 = 2.0; // Update the docs when modifying
const DEFAULT_CLIFF_THRESHOLD_1: f32 = 45.; // Update the docs when modifying
const DEFAULT_CLIFF_THRESHOLD_2: f32 = 55.; // Update the docs when modifying
const DEFAULT_DPI_RESOLUTION: f32 = 600.0; // Update the docs when modifying
Expand Down
13 changes: 11 additions & 2 deletions src/vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ pub fn render_osm_vector_shapes(tile: &Tile, image_width: u32, image_height: u32
};

// 502 wide road
if highway == "secondary" || highway == "tertiary" {
if highway == "primary"
|| highway == "secondary"
|| highway == "tertiary"
|| highway == "residential"
{
map_renderer = map_renderer.draw_line(&line, VECTOR_BLACK, WIDE_ROAD_OUTER_WIDTH);
map_renderer =
map_renderer.draw_line(&line, VECTOR_PAVED_AREA_BROWN, WIDE_ROAD_INNER_WIDTH);
Expand All @@ -142,7 +146,12 @@ pub fn render_osm_vector_shapes(tile: &Tile, image_width: u32, image_height: u32
}

// 505 footpath
if highway == "path" || highway == "unclassified" {
if highway == "pedestrian"
|| highway == "service"
|| highway == "footway"
|| highway == "path"
|| highway == "unclassified"
{
map_renderer = map_renderer.draw_dashed_line(
line,
VECTOR_BLACK,
Expand Down

0 comments on commit 2055291

Please sign in to comment.