Skip to content

Commit 9b8b9d6

Browse files
HarelMzstadler
andauthored
Make external geojson optional (#45)
* Make exteranl geojson optinal * Add flags to docker-compose * Spelling correction --------- Co-authored-by: zstadler <zeev.stadler@gmail.com>
1 parent 6d3c2f2 commit 9b8b9d6

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Additional arguments to this wrapper besides the Planetiler's arguments:
1515
| `es-address` | The address of the Elasticsearch database | `http://localhost:9200` |
1616
| `es-points-index-alias` | The alias of the index to insert points into, it will create "1" and "2" suffix for the relevant index before switching | `points` |
1717
| `es-bbox-index-alias` | The alias of the index to insert bounding boxes into, it will create "1" and "2" suffix for the relevant index before switching | `bbox` |
18-
| `external-file-path` | Extranl geojson file path to allow adding non OSM features to the search and POIs. these features should have a specific format | `data/sources/external.geojson` |
18+
| `external-file-path` | External geojson file path to allow adding non OSM features to the search and POIs. these features should have a specific format | "empty" |
1919

2020
To run using docker (While having a local elasticsearch running at 9200):
2121

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
command:
1111
- --es-address=http://localhost:9200
1212
- --download
13+
- --external-file-path=data/sources/external.geojson
1314
depends_on:
1415
- elasticsearch
1516

src/main/java/il/org/osm/israelhiking/MainClass.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,21 @@ static void run(Arguments args) throws Exception {
3232
var pointsIndexAlias = args.getString("es-points-index-alias", "Elasticsearch index to populate points", "points");
3333
var bboxIndexAlias = args.getString("es-bbox-index-alias", "Elasticsearch index to populate bounding boxes", "bbox");
3434
var supportedLanguages = args.getString("languages", "Languages to support", "en,he,ru,ar").split(",");
35-
var externalFilePath = Path.of(args.getString("external-file-path", "Extranl file path", "data/sources/external.geojson"));
35+
var externalFilePath = args.getString("external-file-path", "Extranl file path", "");
3636
var targetPointsIndex = ElasticsearchHelper.createPointsIndex(esClient, pointsIndexAlias, supportedLanguages);
3737
var targetBBoxIndex = ElasticsearchHelper.createBBoxIndex(esClient, bboxIndexAlias, supportedLanguages);
3838
var profile = new PlanetSearchProfile(planetiler.config(), esClient, targetPointsIndex, targetBBoxIndex, supportedLanguages);
3939

4040
String area = args.getString("area", "geofabrik area to download", "israel-and-palestine");
41-
planetiler.setProfile(profile)
41+
planetiler.setProfile(profile);
4242
// override this default with osm_path="path/to/data.osm.pbf"
43-
.addOsmSource("osm", Path.of("data", "sources", area + ".osm.pbf"), "geofabrik:" + area)
44-
.addGeoJsonSource("external", externalFilePath)
43+
planetiler.addOsmSource("osm", Path.of("data", "sources", area + ".osm.pbf"), "geofabrik:" + area);
44+
if ("" != externalFilePath) {
45+
planetiler.addGeoJsonSource("external", Path.of(externalFilePath));
46+
}
4547
// override this default with mbtiles="path/to/output.mbtiles"
46-
.overwriteOutput(Path.of("data", "target", PlanetSearchProfile.POINTS_LAYER_NAME + ".pmtiles"))
47-
.run();
48+
planetiler.overwriteOutput(Path.of("data", "target", PlanetSearchProfile.POINTS_LAYER_NAME + ".pmtiles"));
49+
planetiler.run();
4850

4951
ElasticsearchHelper.switchAlias(esClient, pointsIndexAlias, targetPointsIndex);
5052
ElasticsearchHelper.switchAlias(esClient, bboxIndexAlias, targetBBoxIndex);

0 commit comments

Comments
 (0)