Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
26df3a0
Create inital workflow for daylight
bchapuis Aug 26, 2023
0efd709
Add decompress task
bchapuis Aug 27, 2023
743eb17
Fix workflow
bchapuis Aug 27, 2023
7ab0af3
Fix workflow
bchapuis Aug 27, 2023
5896ddc
Fix workflow
bchapuis Aug 28, 2023
8d2d2ae
Fix coastline in workflow
bchapuis Aug 28, 2023
4d70327
Fix compression
bchapuis Aug 28, 2023
37c85db
Fix NoSuchElementException in workflow executor
bchapuis Aug 28, 2023
ae9d215
Fix incorect durations in workflow
bchapuis Aug 28, 2023
d107cd2
Display durations of 0 ms
bchapuis Aug 28, 2023
d0278cc
Display durations of 0 ms
bchapuis Aug 28, 2023
c094710
wqRename import osm task and add osc task
bchapuis Aug 28, 2023
ded7b75
Improve change importer with copy api
bchapuis Aug 28, 2023
a399275
Fix compilation error
bchapuis Aug 28, 2023
036efed
Delete before import to prevent pk violations
bchapuis Aug 29, 2023
852b797
Replace ANY by IN in delete query
bchapuis Aug 29, 2023
dbdacee
Replace executeBatch by execute
bchapuis Aug 29, 2023
ce05a6a
Use bigint instead of int8
bchapuis Aug 29, 2023
09fa979
Fix delete query
bchapuis Aug 29, 2023
440b08a
Fix null pointer exception
bchapuis Aug 29, 2023
5eb7178
Import water polygons
bchapuis Aug 29, 2023
f547066
Handle null geometries in shapefile
bchapuis Aug 29, 2023
496f759
Adapt the workflow to daylight
bchapuis Aug 29, 2023
76a6cd8
Improve the workflow
bchapuis Aug 30, 2023
e5b043f
Log queries
bchapuis Sep 13, 2023
59a8695
wFix queries
bchapuis Sep 18, 2023
09e3812
Add demo config
bchapuis Sep 18, 2023
aa5346f
Fix conflicts
bchapuis Sep 18, 2023
573ec02
Print exception
bchapuis Sep 18, 2023
2a51d29
Fix tileset setter
bchapuis Sep 18, 2023
7d492fe
Remove try catch
bchapuis Sep 18, 2023
b53cfe0
Fix configuration
bchapuis Sep 18, 2023
9081f41
Implement compression at the import stage
bchapuis Sep 23, 2023
e12c61e
Format code
bchapuis Sep 23, 2023
67c3f55
Assume that osm change files are standalone
bchapuis Sep 28, 2023
25a4273
Fix database object in workflow
bchapuis Sep 28, 2023
62b65be
Revert changes
bchapuis Sep 28, 2023
3aacd5e
Fix workflow
bchapuis Sep 29, 2023
9e4741a
Format the code with spotless
bchapuis Sep 29, 2023
6095ac1
test only the building step
bchapuis Sep 30, 2023
505681d
Move the workflow in a separate directory and rename the steps
bchapuis Oct 26, 2023
0cfdebe
Upgrade daylight to v1.32
bchapuis Oct 26, 2023
ac993fd
Fix issues in the workflow
bchapuis Oct 27, 2023
33c7816
Move layers in separate directories
bchapuis Oct 27, 2023
5978cd6
Log prepared statement
bchapuis Oct 27, 2023
d43709f
Make the replacement of tables optional
bchapuis Oct 27, 2023
eacecfc
Fix lon/lat inversion in change reader
bchapuis Oct 29, 2023
8055dbd
Format code
bchapuis Oct 29, 2023
972ff78
Fix the coastline layer
bchapuis Oct 31, 2023
2e74304
Add lancover layer
bchapuis Oct 31, 2023
7938ba0
Add landcover data
bchapuis Oct 31, 2023
3ef2976
Simplify scripts
bchapuis Oct 31, 2023
d87afec
Correct attribution and improve highway layer
bchapuis Oct 31, 2023
1dd89d1
Add task to import daylight transtations
bchapuis Oct 31, 2023
89e1334
Add a task to import daylight features
bchapuis Oct 31, 2023
c4e8b3e
Simplify workflow
bchapuis Oct 31, 2023
3120bce
Fix tests
bchapuis Oct 31, 2023
edc6ce0
Fix null pointer exception
bchapuis Nov 1, 2023
b82a5de
Share the cache between workflow steps
bchapuis Nov 2, 2023
3bf91b9
Do not use the geometry of important features
bchapuis Nov 2, 2023
ce2b4a2
Fix cache
bchapuis Nov 3, 2023
b7c104d
Fix the creation of directories
bchapuis Nov 3, 2023
af6acaa
Upgrade daylight to v1.33
bchapuis Nov 6, 2023
f4302fa
Reactivate the linework for highways
bchapuis Nov 6, 2023
aa8e878
Improve naming
bchapuis Nov 7, 2023
7352fb5
Add wikidata processor
bchapuis Nov 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .run/basemap-dev.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<module name="baremaps-cli" />
<option name="PROGRAM_PARAMETERS" value="map dev --tileset tileset.js --style style.js" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/basemap" />
<extension name="coverage">
<pattern>
<option name="ENABLED" value="true" />
</pattern>
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<method v="2">
<option name="Make" enabled="true" />
Expand Down
5 changes: 0 additions & 5 deletions .run/basemap-mbtiles.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
<module name="baremaps-cli" />
<option name="PROGRAM_PARAMETERS" value="map mbtiles --mbtiles tiles.mbtiles --tilejson tileset.js --style style.js" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/basemap" />
<extension name="coverage">
<pattern>
<option name="ENABLED" value="true" />
</pattern>
</extension>
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
Expand Down
8 changes: 4 additions & 4 deletions .run/basemap-serve.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<module name="baremaps-cli" />
<option name="PROGRAM_PARAMETERS" value="map serve --tileset tileset.js --style style.js" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/basemap" />
<extension name="coverage">
<pattern>
<option name="ENABLED" value="true" />
</pattern>
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<method v="2">
<option name="Make" enabled="true" />
Expand Down
8 changes: 4 additions & 4 deletions .run/basemap-workflow.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<module name="baremaps-cli" />
<option name="PROGRAM_PARAMETERS" value="workflow execute --file workflow.js" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/basemap" />
<extension name="coverage">
<pattern>
<option name="ENABLED" value="true" />
</pattern>
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<method v="2">
<option name="Make" enabled="true" />
Expand Down
5 changes: 5 additions & 0 deletions .run/naturalearth-create.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
<module name="baremaps-cli" />
<option name="PROGRAM_PARAMETERS" value="workflow execute --file workflow.json" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/examples/naturalearth" />
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
Expand Down
5 changes: 5 additions & 0 deletions .run/naturalearth-dev.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
<module name="baremaps-cli" />
<option name="PROGRAM_PARAMETERS" value="map dev --tileset tileset.json --style style.json" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/examples/naturalearth" />
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension">
<option name="credential" />
<option name="region" />
<option name="useCurrentConnection" value="false" />
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import picocli.CommandLine.Command;

@Command(name = "database", description = "Database commands.",
subcommands = {ExecuteSql.class, ImportOpenStreetMap.class, UpdateOpenStreetMap.class},
subcommands = {ExecuteSql.class, ImportOsmPbf.class, UpdateOpenStreetMap.class},
sortOptions = false)
public class Database implements Runnable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import picocli.CommandLine.Option;

@Command(name = "import-osm", description = "Import OpenStreetMap data in Postgres.")
public class ImportOpenStreetMap implements Callable<Integer> {
public class ImportOsmPbf implements Callable<Integer> {

@Mixin
private Options options;
Expand All @@ -47,8 +47,13 @@ public class ImportOpenStreetMap implements Callable<Integer> {

@Override
public Integer call() throws Exception {
new org.apache.baremaps.workflow.tasks.ImportOpenStreetMap(file.toAbsolutePath(),
database, srid).execute(new WorkflowContext());
new org.apache.baremaps.workflow.tasks.ImportOsmPbf(
file.toAbsolutePath(),
null,
true,
database,
srid,
true).execute(new WorkflowContext());
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.concurrent.Callable;
import org.apache.baremaps.cli.Options;
import org.apache.baremaps.workflow.WorkflowContext;
import org.apache.baremaps.workflow.tasks.UpdateOsmDatabase;
import picocli.CommandLine.Command;
import picocli.CommandLine.Mixin;
import picocli.CommandLine.Option;
Expand All @@ -42,7 +43,7 @@ public class UpdateOpenStreetMap implements Callable<Integer> {

@Override
public Integer call() throws Exception {
new org.apache.baremaps.workflow.tasks.UpdateOpenStreetMap(database, srid)
new UpdateOsmDatabase(database, srid)
.execute(new WorkflowContext());
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ public Integer call() throws Exception {
var tileStoreType = new TypeLiteral<Supplier<TileStore>>() {};
var tileStoreSupplier = (Supplier<TileStore>) () -> {
try {
var config = configReader.read(this.tilesetPath);
var tilesetObject =
objectMapper.readValue(configReader.read(this.tilesetPath), Tileset.class);
objectMapper.readValue(config, Tileset.class);
return new PostgresTileStore(datasource, tilesetObject);
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class GeocoderOsmDocumentMapper implements Function<Element, Document> {
@Override
public Document apply(Element element) {
var document = new Document();
document.add(new StoredField("osm_id", element.id()));
document.add(new StoredField("osm_id", element.getId()));
document.add(new StoredField("osm_type", element.getClass().getSimpleName()));

if (element.getTags().containsKey(OsmTags.NAME.key())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ private Stream<Geometry> geometriesForPreviousVersion(Change change) {
private Optional<Geometry> geometriesForPreviousVersion(Entity entity) {
try {
if (entity instanceof Node node) {
var previousNode = nodeRepository.get(node.id());
var previousNode = nodeRepository.get(node.getId());
return Optional.ofNullable(previousNode).map(Node::getGeometry);
} else if (entity instanceof Way way) {
var previousWay = wayRepository.get(way.id());
var previousWay = wayRepository.get(way.getId());
return Optional.ofNullable(previousWay).map(Way::getGeometry);
} else if (entity instanceof Relation relation) {
var previousRelation = relationRepository.get(relation.id());
var previousRelation = relationRepository.get(relation.getId());
return Optional.ofNullable(previousRelation).map(Relation::getGeometry);
} else {
return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public CoordinateMapBuilder(DataMap<Long, Coordinate> coordinateMap) {
@Override
public void accept(Entity entity) {
if (entity instanceof Node node) {
coordinateMap.put(node.id(), new Coordinate(node.getLon(), node.getLat()));
coordinateMap.put(node.getId(), new Coordinate(node.getLon(), node.getLat()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public GeometryMapBuilder(DataMap<Long, Geometry> geometryMap, Predicate<Entity>
@Override
public void accept(Entity entity) {
if (filter.test(entity) && entity instanceof Element element) {
geometryMap.put(element.id(), element.getGeometry());
geometryMap.put(element.getId(), element.getGeometry());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class OpenstreetmapDocumentMapper implements Function<Element, Document>
public Document apply(Element element) {
var document = new Document();

document.add(new StoredField("id", element.id()));
document.add(new StoredField("id", element.getId()));

element.getTags().forEach((key, value) -> {
document.add(new StoredField(key, value.toString()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ReferenceMapBuilder(DataMap<Long, List<Long>> referenceMap) {
@Override
public void accept(Entity entity) {
if (entity instanceof Way way) {
referenceMap.put(way.id(), way.getNodes());
referenceMap.put(way.getId(), way.getNodes());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ public void accept(Relation relation) {
var end = System.currentTimeMillis();
var duration = end - start;
if (duration > 60 * 1000) {
logger.debug("Relation #{} processed in {} ms", relation.id(), duration);
logger.debug("Relation #{} processed in {} ms", relation.getId(), duration);
}
} catch (Exception e) {
logger.debug("Unable to build the geometry for relation #" + relation.id(), e);
logger.debug("Unable to build the geometry for relation #" + relation.getId(), e);
relation.setGeometry(GEOMETRY_FACTORY_WGS84.createEmpty(0));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void accept(Way way) {
}
}
} catch (Exception e) {
logger.debug("Unable to build the geometry for way #" + way.id(), e);
logger.debug("Unable to build the geometry for way #" + way.getId(), e);
way.setGeometry(GEOMETRY_FACTORY_WGS84.createEmpty(0));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@ abstract class Element implements Entity
permits Node, Way, Relation
{

protected final long id;
protected Long id;

protected final Info info;
protected Info info;

protected final Map<String, Object> tags;
protected Map<String, Object> tags;

protected Geometry geometry;

protected Element() {

}

protected Element(long id, Info info, Map<String, Object> tags) {
this(id, info, tags, null);
}
Expand All @@ -66,10 +70,17 @@ protected Element(long id, Info info, Map<String, Object> tags, Geometry geometr
*
* @return the id
*/
public long id() {
public long getId() {
return id;
}

/**
* Sets the id.
*/
public void setId(long id) {
this.id = id;
}

/**
* Returns the info.
*
Expand All @@ -79,6 +90,15 @@ public Info getInfo() {
return info;
}

/**
* Sets the info.
*
* @param info the info
*/
public void setInfo(Info info) {
this.info = info;
}

/**
* Returns the tags.
*
Expand All @@ -88,6 +108,15 @@ public Map<String, Object> getTags() {
return tags;
}

/**
* Sets the tags.
*
* @param tags the tags
*/
public void setTags(Map<String, Object> tags) {
this.tags = tags;
}

/**
* Returns the geometry.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@
/** Represents a node element in an OpenStreetMap dataset. */
public final class Node extends Element {

private final double lon;
private Double lon;

private final double lat;
private Double lat;

/**
* Constructs an OpenStreetMap {@code Node}.
*/
public Node() {
super();
}

/**
* Constructs an OpenStreetMap {@code Node} with the specified parameters.
Expand All @@ -40,7 +47,7 @@ public final class Node extends Element {
* @param lon the longitude
* @param lat the latitude
*/
public Node(long id, Info info, Map<String, Object> tags, double lon, double lat) {
public Node(Long id, Info info, Map<String, Object> tags, Double lon, Double lat) {
super(id, info, tags);
this.lon = lon;
this.lat = lat;
Expand All @@ -56,7 +63,7 @@ public Node(long id, Info info, Map<String, Object> tags, double lon, double lat
* @param lat the latitude
* @param geometry the geometry
*/
public Node(long id, Info info, Map<String, Object> tags, double lon, double lat,
public Node(Long id, Info info, Map<String, Object> tags, Double lon, Double lat,
Geometry geometry) {
super(id, info, tags, geometry);
this.lon = lon;
Expand All @@ -68,19 +75,37 @@ public Node(long id, Info info, Map<String, Object> tags, double lon, double lat
*
* @return the longitude
*/
public double getLon() {
public Double getLon() {
return lon;
}

/**
* Sets the longitude.
*
* @param lon the longitude
*/
public void setLon(Double lon) {
this.lon = lon;
}

/**
* Returns the latitude.
*
* @return the latitude
*/
public double getLat() {
public Double getLat() {
return lat;
}

/**
* Sets the latitude.
*
* @param lat the latitude
*/
public void setLat(Double lat) {
this.lat = lat;
}

/** {@inheritDoc} */
@Override
public boolean equals(Object o) {
Expand Down
Loading