Skip to content

Commit

Permalink
Refactor the openstreetmap module
Browse files Browse the repository at this point in the history
  • Loading branch information
bchapuis committed Nov 7, 2024
1 parent 4a09b41 commit 8c61445
Show file tree
Hide file tree
Showing 100 changed files with 277 additions and 272 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import java.util.concurrent.Callable;
import org.apache.baremaps.maplibre.tileset.Tileset;
import org.apache.baremaps.maplibre.tileset.TilesetLayer;
import org.apache.baremaps.openstreetmap.stream.ProgressLogger;
import org.apache.baremaps.openstreetmap.stream.StreamUtils;
import org.apache.baremaps.openstreetmap.format.stream.ProgressLogger;
import org.apache.baremaps.openstreetmap.format.stream.StreamUtils;
import org.apache.baremaps.tilestore.TileCoord;
import org.apache.baremaps.tilestore.TileEntry;
import org.apache.baremaps.tilestore.TileStoreException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.baremaps.database;

import static org.apache.baremaps.openstreetmap.stream.ConsumerUtils.consumeThenReturn;
import static org.apache.baremaps.openstreetmap.format.stream.ConsumerUtils.consumeThenReturn;

import java.io.BufferedInputStream;
import java.net.MalformedURLException;
Expand All @@ -30,12 +30,12 @@
import java.util.zip.GZIPInputStream;
import org.apache.baremaps.database.postgres.HeaderRepository;
import org.apache.baremaps.database.postgres.Repository;
import org.apache.baremaps.openstreetmap.function.EntityGeometryBuilder;
import org.apache.baremaps.openstreetmap.function.EntityToGeometryMapper;
import org.apache.baremaps.openstreetmap.function.ProjectionTransformer;
import org.apache.baremaps.openstreetmap.model.*;
import org.apache.baremaps.openstreetmap.stream.StreamException;
import org.apache.baremaps.openstreetmap.xml.XmlChangeReader;
import org.apache.baremaps.openstreetmap.format.function.EntityGeometryBuilder;
import org.apache.baremaps.openstreetmap.format.function.EntityToGeometryMapper;
import org.apache.baremaps.openstreetmap.format.function.ProjectionTransformer;
import org.apache.baremaps.openstreetmap.format.model.*;
import org.apache.baremaps.openstreetmap.format.stream.StreamException;
import org.apache.baremaps.openstreetmap.format.xml.XmlChangeReader;
import org.apache.baremaps.tilestore.TileCoord;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

import java.util.function.Consumer;
import org.apache.baremaps.database.postgres.Repository;
import org.apache.baremaps.openstreetmap.model.*;
import org.apache.baremaps.openstreetmap.stream.StreamException;
import org.apache.baremaps.openstreetmap.format.model.*;
import org.apache.baremaps.openstreetmap.format.stream.StreamException;

/** A consumer for importing OpenStreetMap blocks in a database. */
public class BlockImporter implements Consumer<Block> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import java.util.function.Consumer;
import org.apache.baremaps.database.postgres.Repository;
import org.apache.baremaps.database.postgres.RepositoryException;
import org.apache.baremaps.openstreetmap.model.Change;
import org.apache.baremaps.openstreetmap.model.Element;
import org.apache.baremaps.openstreetmap.format.model.Change;
import org.apache.baremaps.openstreetmap.format.model.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.function.Consumer;
import org.apache.baremaps.database.postgres.Repository;
import org.apache.baremaps.database.postgres.RepositoryException;
import org.apache.baremaps.openstreetmap.model.*;
import org.apache.baremaps.openstreetmap.format.model.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.function.Consumer;
import org.apache.baremaps.database.postgres.Repository;
import org.apache.baremaps.database.postgres.RepositoryException;
import org.apache.baremaps.openstreetmap.model.*;
import org.apache.baremaps.openstreetmap.format.model.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import java.util.Map;
import javax.sql.DataSource;
import org.apache.baremaps.database.copy.CopyWriter;
import org.apache.baremaps.openstreetmap.model.Header;
import org.apache.baremaps.openstreetmap.format.model.Header;
import org.postgresql.PGConnection;
import org.postgresql.copy.PGCopyOutputStream;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
import java.util.Map;
import javax.sql.DataSource;
import org.apache.baremaps.database.copy.CopyWriter;
import org.apache.baremaps.openstreetmap.model.Info;
import org.apache.baremaps.openstreetmap.model.Node;
import org.apache.baremaps.openstreetmap.utils.GeometryUtils;
import org.apache.baremaps.openstreetmap.format.model.Info;
import org.apache.baremaps.openstreetmap.format.model.Node;
import org.apache.baremaps.openstreetmap.format.utils.GeometryUtils;
import org.locationtech.jts.geom.Geometry;
import org.postgresql.PGConnection;
import org.postgresql.copy.PGCopyOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
import java.util.*;
import javax.sql.DataSource;
import org.apache.baremaps.database.copy.CopyWriter;
import org.apache.baremaps.openstreetmap.model.Info;
import org.apache.baremaps.openstreetmap.model.Member;
import org.apache.baremaps.openstreetmap.model.Member.MemberType;
import org.apache.baremaps.openstreetmap.model.Relation;
import org.apache.baremaps.openstreetmap.utils.GeometryUtils;
import org.apache.baremaps.openstreetmap.format.model.Info;
import org.apache.baremaps.openstreetmap.format.model.Member;
import org.apache.baremaps.openstreetmap.format.model.Member.MemberType;
import org.apache.baremaps.openstreetmap.format.model.Relation;
import org.apache.baremaps.openstreetmap.format.utils.GeometryUtils;
import org.locationtech.jts.geom.Geometry;
import org.postgresql.PGConnection;
import org.postgresql.copy.PGCopyOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import java.util.Map;
import javax.sql.DataSource;
import org.apache.baremaps.database.copy.CopyWriter;
import org.apache.baremaps.openstreetmap.model.Info;
import org.apache.baremaps.openstreetmap.model.Way;
import org.apache.baremaps.openstreetmap.utils.GeometryUtils;
import org.apache.baremaps.openstreetmap.format.model.Info;
import org.apache.baremaps.openstreetmap.format.model.Way;
import org.apache.baremaps.openstreetmap.format.utils.GeometryUtils;
import org.locationtech.jts.geom.Geometry;
import org.postgresql.PGConnection;
import org.postgresql.copy.PGCopyOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@


import java.util.function.Function;
import org.apache.baremaps.openstreetmap.model.Element;
import org.apache.baremaps.openstreetmap.model.Node;
import org.apache.baremaps.openstreetmap.format.model.Element;
import org.apache.baremaps.openstreetmap.format.model.Node;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.LatLonShape;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package org.apache.baremaps.geocoder.openstreetmap;

import java.util.function.Consumer;
import org.apache.baremaps.openstreetmap.model.Element;
import org.apache.baremaps.openstreetmap.model.Entity;
import org.apache.baremaps.openstreetmap.format.model.Element;
import org.apache.baremaps.openstreetmap.format.model.Entity;
import org.apache.lucene.index.IndexWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.List;
import java.util.stream.Stream;
import javax.sql.DataSource;
import org.apache.baremaps.openstreetmap.stream.StreamUtils;
import org.apache.baremaps.openstreetmap.format.stream.StreamUtils;
import org.locationtech.jts.geom.Coordinate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import javax.sql.DataSource;
import org.apache.baremaps.openstreetmap.utils.GeometryUtils;
import org.apache.baremaps.openstreetmap.format.utils.GeometryUtils;
import org.apache.baremaps.store.*;
import org.locationtech.jts.geom.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import java.util.StringJoiner;
import org.apache.baremaps.geocoder.GeocoderConstants;
import org.apache.baremaps.geocoder.openstreetmap.OpenStreetMapEntityConsumer;
import org.apache.baremaps.openstreetmap.pbf.PbfEntityReader;
import org.apache.baremaps.openstreetmap.stream.StreamUtils;
import org.apache.baremaps.openstreetmap.format.pbf.PbfEntityReader;
import org.apache.baremaps.openstreetmap.format.stream.StreamUtils;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.apache.lucene.index.IndexWriter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.util.StringJoiner;
import org.apache.baremaps.iploc.IpLocReader;
import org.apache.baremaps.iploc.IpLocRepository;
import org.apache.baremaps.openstreetmap.stream.StreamException;
import org.apache.baremaps.openstreetmap.format.stream.StreamException;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.apache.lucene.search.SearcherFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import org.apache.baremaps.maplibre.style.Style;
import org.apache.baremaps.maplibre.tileset.Tileset;
import org.apache.baremaps.maplibre.tileset.TilesetQuery;
import org.apache.baremaps.openstreetmap.stream.ProgressLogger;
import org.apache.baremaps.openstreetmap.stream.StreamUtils;
import org.apache.baremaps.openstreetmap.format.stream.ProgressLogger;
import org.apache.baremaps.openstreetmap.format.stream.StreamUtils;
import org.apache.baremaps.tilestore.*;
import org.apache.baremaps.tilestore.file.FileTileStore;
import org.apache.baremaps.tilestore.mbtiles.MBTilesStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.Map;
import java.util.StringJoiner;
import org.apache.baremaps.database.postgres.*;
import org.apache.baremaps.openstreetmap.model.Element;
import org.apache.baremaps.openstreetmap.format.model.Element;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.StringJoiner;
import java.util.stream.Collectors;
import org.apache.baremaps.database.postgres.*;
import org.apache.baremaps.openstreetmap.model.Element;
import org.apache.baremaps.openstreetmap.format.model.Element;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.nio.file.Path;
import java.util.StringJoiner;
import org.apache.baremaps.geopackage.store.GeoPackageDataStore;
import org.apache.baremaps.openstreetmap.function.ProjectionTransformer;
import org.apache.baremaps.openstreetmap.format.function.ProjectionTransformer;
import org.apache.baremaps.storage.postgres.PostgresDataStore;
import org.apache.baremaps.store.DataTableGeometryMapper;
import org.apache.baremaps.store.DataTableMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.StringJoiner;
import org.apache.baremaps.geoparquet.store.GeoParquetDataStore;
import org.apache.baremaps.geoparquet.store.GeoParquetDataTable;
import org.apache.baremaps.openstreetmap.function.ProjectionTransformer;
import org.apache.baremaps.openstreetmap.format.function.ProjectionTransformer;
import org.apache.baremaps.storage.postgres.PostgresDataStore;
import org.apache.baremaps.store.DataTableGeometryMapper;
import org.apache.baremaps.store.DataTableMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@

package org.apache.baremaps.workflow.tasks;

import static org.apache.baremaps.openstreetmap.stream.ConsumerUtils.consumeThenReturn;
import static org.apache.baremaps.openstreetmap.format.stream.ConsumerUtils.consumeThenReturn;

import java.io.BufferedInputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.StringJoiner;
import org.apache.baremaps.database.function.CopyChangeImporter;
import org.apache.baremaps.database.postgres.*;
import org.apache.baremaps.openstreetmap.function.*;
import org.apache.baremaps.openstreetmap.xml.XmlChangeReader;
import org.apache.baremaps.openstreetmap.format.function.*;
import org.apache.baremaps.openstreetmap.format.xml.XmlChangeReader;
import org.apache.baremaps.utils.Compression;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
import java.util.StringJoiner;
import org.apache.baremaps.database.function.BlockImporter;
import org.apache.baremaps.database.postgres.*;
import org.apache.baremaps.openstreetmap.model.Node;
import org.apache.baremaps.openstreetmap.model.Relation;
import org.apache.baremaps.openstreetmap.model.Way;
import org.apache.baremaps.openstreetmap.pbf.PbfBlockReader;
import org.apache.baremaps.openstreetmap.stream.StreamUtils;
import org.apache.baremaps.openstreetmap.format.model.Node;
import org.apache.baremaps.openstreetmap.format.model.Relation;
import org.apache.baremaps.openstreetmap.format.model.Way;
import org.apache.baremaps.openstreetmap.format.pbf.PbfBlockReader;
import org.apache.baremaps.openstreetmap.format.stream.StreamUtils;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.locationtech.jts.geom.Coordinate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import java.nio.file.Path;
import java.util.StringJoiner;
import org.apache.baremaps.openstreetmap.function.ProjectionTransformer;
import org.apache.baremaps.openstreetmap.format.function.ProjectionTransformer;
import org.apache.baremaps.shapefile.store.ShapefileDataTable;
import org.apache.baremaps.storage.postgres.PostgresDataStore;
import org.apache.baremaps.store.DataTableGeometryMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
import java.util.zip.GZIPInputStream;
import org.apache.baremaps.database.function.ChangeElementsImporter;
import org.apache.baremaps.database.postgres.*;
import org.apache.baremaps.openstreetmap.function.*;
import org.apache.baremaps.openstreetmap.model.Header;
import org.apache.baremaps.openstreetmap.model.Node;
import org.apache.baremaps.openstreetmap.model.Relation;
import org.apache.baremaps.openstreetmap.model.Way;
import org.apache.baremaps.openstreetmap.state.StateReader;
import org.apache.baremaps.openstreetmap.xml.XmlChangeReader;
import org.apache.baremaps.openstreetmap.format.function.*;
import org.apache.baremaps.openstreetmap.format.model.Header;
import org.apache.baremaps.openstreetmap.format.model.Node;
import org.apache.baremaps.openstreetmap.format.model.Relation;
import org.apache.baremaps.openstreetmap.format.model.Way;
import org.apache.baremaps.openstreetmap.format.state.StateReader;
import org.apache.baremaps.openstreetmap.format.xml.XmlChangeReader;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.locationtech.jts.geom.Coordinate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import java.util.Arrays;
import java.util.List;
import org.apache.baremaps.openstreetmap.model.Header;
import org.apache.baremaps.openstreetmap.format.model.Header;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import java.util.Arrays;
import java.util.List;
import org.apache.baremaps.database.repository.Constants;
import org.apache.baremaps.openstreetmap.model.Element;
import org.apache.baremaps.openstreetmap.model.Node;
import org.apache.baremaps.openstreetmap.format.model.Element;
import org.apache.baremaps.openstreetmap.format.model.Node;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import java.util.Arrays;
import java.util.List;
import org.apache.baremaps.database.repository.Constants;
import org.apache.baremaps.openstreetmap.model.Element;
import org.apache.baremaps.openstreetmap.model.Relation;
import org.apache.baremaps.openstreetmap.format.model.Element;
import org.apache.baremaps.openstreetmap.format.model.Relation;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import java.util.Arrays;
import java.util.List;
import org.apache.baremaps.database.repository.Constants;
import org.apache.baremaps.openstreetmap.model.Element;
import org.apache.baremaps.openstreetmap.model.Way;
import org.apache.baremaps.openstreetmap.format.model.Element;
import org.apache.baremaps.openstreetmap.format.model.Way;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.apache.baremaps.database.PostgresContainerTest;
import org.apache.baremaps.database.function.BlockImporter;
import org.apache.baremaps.database.postgres.*;
import org.apache.baremaps.openstreetmap.pbf.PbfBlockReader;
import org.apache.baremaps.openstreetmap.format.pbf.PbfBlockReader;
import org.apache.baremaps.utils.PostgresUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.time.LocalDateTime;
import org.apache.baremaps.openstreetmap.model.Header;
import org.apache.baremaps.openstreetmap.model.Info;
import org.apache.baremaps.openstreetmap.model.Member;
import org.apache.baremaps.openstreetmap.model.Member.MemberType;
import org.apache.baremaps.openstreetmap.model.Node;
import org.apache.baremaps.openstreetmap.model.Relation;
import org.apache.baremaps.openstreetmap.model.Way;
import org.apache.baremaps.openstreetmap.format.model.Header;
import org.apache.baremaps.openstreetmap.format.model.Info;
import org.apache.baremaps.openstreetmap.format.model.Member;
import org.apache.baremaps.openstreetmap.format.model.Member.MemberType;
import org.apache.baremaps.openstreetmap.format.model.Node;
import org.apache.baremaps.openstreetmap.format.model.Relation;
import org.apache.baremaps.openstreetmap.format.model.Way;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.PrecisionModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.apache.baremaps.openstreetmap.function.ProjectionTransformer;
import org.apache.baremaps.openstreetmap.format.function.ProjectionTransformer;
import org.junit.jupiter.api.Test;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
import org.apache.baremaps.database.postgres.ReferenceMap;
import org.apache.baremaps.database.postgres.RelationRepository;
import org.apache.baremaps.database.postgres.WayRepository;
import org.apache.baremaps.openstreetmap.model.Header;
import org.apache.baremaps.openstreetmap.state.StateReader;
import org.apache.baremaps.openstreetmap.format.model.Header;
import org.apache.baremaps.openstreetmap.format.state.StateReader;
import org.apache.baremaps.testing.TestFiles;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down
Loading

0 comments on commit 8c61445

Please sign in to comment.