Skip to content

Commit

Permalink
Move flatgeobuf store from the core to the flatgeobuf module
Browse files Browse the repository at this point in the history
  • Loading branch information
bchapuis committed Nov 7, 2024
1 parent e9fa9f5 commit 86065fc
Show file tree
Hide file tree
Showing 34 changed files with 73 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.baremaps.geocoder;

import java.util.function.Consumer;
import org.apache.baremaps.data.storage.DataRow;
import org.apache.baremaps.store.DataRow;
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 @@ -26,9 +26,9 @@
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import org.apache.baremaps.data.storage.DataColumn;
import org.apache.baremaps.data.storage.DataRow;
import org.apache.baremaps.data.storage.DataSchema;
import org.apache.baremaps.store.DataColumn;
import org.apache.baremaps.store.DataRow;
import org.apache.baremaps.store.DataSchema;
import org.apache.lucene.document.*;
import org.locationtech.jts.geom.*;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.baremaps.data.storage.DataColumn;
import org.apache.baremaps.data.storage.DataSchema;
import org.apache.baremaps.store.DataColumn;
import org.apache.baremaps.store.DataSchema;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.queryparser.classic.QueryParserBase;
import org.apache.lucene.queryparser.simple.SimpleQueryParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import org.apache.baremaps.data.storage.DataSchema;
import org.apache.baremaps.data.storage.DataStore;
import org.apache.baremaps.data.storage.DataStoreException;
import org.apache.baremaps.data.storage.DataTable;
import org.apache.baremaps.store.DataSchema;
import org.apache.baremaps.store.DataStore;
import org.apache.baremaps.store.DataStoreException;
import org.apache.baremaps.store.DataTable;

/**
* A DataStore implementation that manages a single CSV file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.util.*;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.store.*;
import org.locationtech.jts.io.WKTReader;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import java.util.List;
import mil.nga.geopackage.GeoPackage;
import mil.nga.geopackage.GeoPackageManager;
import org.apache.baremaps.data.storage.DataStore;
import org.apache.baremaps.data.storage.DataStoreException;
import org.apache.baremaps.data.storage.DataTable;
import org.apache.baremaps.store.DataStore;
import org.apache.baremaps.store.DataStoreException;
import org.apache.baremaps.store.DataTable;

/**
* A {@link DataStore} corresponding to a GeoPackage file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import mil.nga.geopackage.features.user.FeatureDao;
import mil.nga.geopackage.features.user.FeatureResultSet;
import mil.nga.geopackage.geom.GeoPackageGeometryData;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.data.storage.DataColumn.Cardinality;
import org.apache.baremaps.data.storage.DataColumn.Type;
import org.apache.baremaps.store.*;
import org.apache.baremaps.store.DataColumn.Cardinality;
import org.apache.baremaps.store.DataColumn.Type;
import org.locationtech.jts.geom.*;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import java.net.URI;
import java.util.List;
import org.apache.baremaps.data.storage.DataStore;
import org.apache.baremaps.data.storage.DataStoreException;
import org.apache.baremaps.data.storage.DataTable;
import org.apache.baremaps.store.DataStore;
import org.apache.baremaps.store.DataStoreException;
import org.apache.baremaps.store.DataTable;

/**
* A {@link DataStore} corresponding to a GeoParquet file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
import java.util.Iterator;
import java.util.Spliterator;
import java.util.stream.Stream;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.geoparquet.GeoParquetException;
import org.apache.baremaps.geoparquet.GeoParquetReader;
import org.apache.baremaps.store.DataRow;
import org.apache.baremaps.store.DataRowImpl;
import org.apache.baremaps.store.DataSchema;
import org.apache.baremaps.store.DataTable;
import org.apache.hadoop.fs.Path;

public class GeoParquetDataTable implements DataTable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.data.storage.DataColumn.Cardinality;
import org.apache.baremaps.data.storage.DataColumn.Type;
import org.apache.baremaps.geoparquet.GeoParquetGroup;
import org.apache.baremaps.geoparquet.GeoParquetSchema;
import org.apache.baremaps.geoparquet.GeoParquetSchema.Field;
import org.apache.baremaps.geoparquet.GeoParquetSchema.GroupField;
import org.apache.baremaps.store.*;
import org.apache.baremaps.store.DataColumn.Cardinality;
import org.apache.baremaps.store.DataColumn.Type;
import org.apache.parquet.io.api.Binary;

public class GeoParquetTypeConversion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import java.io.InputStream;
import java.util.*;
import java.util.stream.Stream;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.openstreetmap.OpenStreetMap.EntityReader;
import org.apache.baremaps.openstreetmap.model.*;
import org.apache.baremaps.store.*;

/**
* A DataTable implementation for OpenStreetMap data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
import java.util.List;
import java.util.stream.Collectors;
import javax.sql.DataSource;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.data.storage.DataColumn.Type;
import org.apache.baremaps.database.copy.CopyWriter;
import org.apache.baremaps.database.copy.EnvelopeValueHandler;
import org.apache.baremaps.database.copy.GeometryValueHandler;
import org.apache.baremaps.database.copy.JsonbValueHandler;
import org.apache.baremaps.database.metadata.DatabaseMetadata;
import org.apache.baremaps.database.metadata.TableMetadata;
import org.apache.baremaps.store.*;
import org.apache.baremaps.store.DataColumn.Type;
import org.postgresql.PGConnection;
import org.postgresql.copy.PGCopyOutputStream;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import javax.sql.DataSource;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.openstreetmap.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 @@ -19,7 +19,7 @@

import java.util.EnumMap;
import java.util.Map;
import org.apache.baremaps.data.storage.DataColumn.Type;
import org.apache.baremaps.store.DataColumn.Type;

@SuppressWarnings("squid:S1192")
public class PostgresTypeConversion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import org.apache.baremaps.data.storage.DataStore;
import org.apache.baremaps.data.storage.DataStoreException;
import org.apache.baremaps.data.storage.DataTable;
import org.apache.baremaps.store.DataStore;
import org.apache.baremaps.store.DataStoreException;
import org.apache.baremaps.store.DataTable;

/**
* A schema corresponding to the shapefiles of a directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
import java.nio.file.Path;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.baremaps.data.storage.DataRow;
import org.apache.baremaps.data.storage.DataSchema;
import org.apache.baremaps.data.storage.DataStoreException;
import org.apache.baremaps.data.storage.DataTable;
import org.apache.baremaps.storage.shapefile.internal.ShapefileInputStream;
import org.apache.baremaps.storage.shapefile.internal.ShapefileReader;
import org.apache.baremaps.store.DataRow;
import org.apache.baremaps.store.DataSchema;
import org.apache.baremaps.store.DataStoreException;
import org.apache.baremaps.store.DataTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.nio.charset.UnsupportedCharsetException;
import java.text.MessageFormat;
import java.util.*;
import org.apache.baremaps.data.storage.DataRow;
import org.apache.baremaps.store.DataRow;

/**
* Reader of a Database Binary content.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.*;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.data.storage.DataColumn.Cardinality;
import org.apache.baremaps.data.storage.DataColumn.Type;
import org.apache.baremaps.store.*;
import org.apache.baremaps.store.DataColumn.Cardinality;
import org.apache.baremaps.store.DataColumn.Type;
import org.locationtech.jts.algorithm.Orientation;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.CoordinateList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import org.apache.baremaps.data.storage.DataRow;
import org.apache.baremaps.data.storage.DataSchema;
import org.apache.baremaps.store.DataRow;
import org.apache.baremaps.store.DataSchema;

/**
* Input Stream of features.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.io.IOException;
import java.util.List;
import java.util.Objects;
import org.apache.baremaps.data.storage.DataSchema;
import org.apache.baremaps.store.DataSchema;

/**
* Provides a ShapeFile Reader.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

import java.nio.file.Path;
import java.util.StringJoiner;
import org.apache.baremaps.data.storage.DataTableGeometryMapper;
import org.apache.baremaps.data.storage.DataTableMapper;
import org.apache.baremaps.openstreetmap.function.ProjectionTransformer;
import org.apache.baremaps.storage.geopackage.GeoPackageDataStore;
import org.apache.baremaps.storage.postgres.PostgresDataStore;
import org.apache.baremaps.store.DataTableGeometryMapper;
import org.apache.baremaps.store.DataTableMapper;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.apache.baremaps.workflow.WorkflowException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

import java.net.URI;
import java.util.StringJoiner;
import org.apache.baremaps.data.storage.DataTableGeometryMapper;
import org.apache.baremaps.data.storage.DataTableMapper;
import org.apache.baremaps.openstreetmap.function.ProjectionTransformer;
import org.apache.baremaps.storage.geoparquet.GeoParquetDataStore;
import org.apache.baremaps.storage.geoparquet.GeoParquetDataTable;
import org.apache.baremaps.storage.postgres.PostgresDataStore;
import org.apache.baremaps.store.DataTableGeometryMapper;
import org.apache.baremaps.store.DataTableMapper;
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 @@ -19,11 +19,11 @@

import java.nio.file.Path;
import java.util.StringJoiner;
import org.apache.baremaps.data.storage.DataTableGeometryMapper;
import org.apache.baremaps.data.storage.DataTableMapper;
import org.apache.baremaps.openstreetmap.function.ProjectionTransformer;
import org.apache.baremaps.storage.postgres.PostgresDataStore;
import org.apache.baremaps.storage.shapefile.ShapefileDataTable;
import org.apache.baremaps.store.DataTableGeometryMapper;
import org.apache.baremaps.store.DataTableMapper;
import org.apache.baremaps.workflow.Task;
import org.apache.baremaps.workflow.WorkflowContext;
import org.apache.baremaps.workflow.WorkflowException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
import org.apache.baremaps.data.calcite.SqlDataTable;
import org.apache.baremaps.data.collection.AppendOnlyLog;
import org.apache.baremaps.data.collection.IndexedDataList;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.data.storage.DataColumn.Cardinality;
import org.apache.baremaps.data.storage.DataColumn.Type;
import org.apache.baremaps.data.store.BaremapsDataTable;
import org.apache.baremaps.data.type.RowDataType;
import org.apache.baremaps.maplibre.vectortile.VectorTileFunctions;
import org.apache.baremaps.store.*;
import org.apache.baremaps.store.DataColumn.Cardinality;
import org.apache.baremaps.store.DataColumn.Type;
import org.apache.calcite.jdbc.CalciteConnection;
import org.apache.calcite.model.ModelHandler;
import org.apache.calcite.runtime.AccumOperation;
Expand Down Expand Up @@ -77,7 +78,7 @@ void test() throws SQLException {
new DataColumnFixed("id", Cardinality.OPTIONAL, Type.INTEGER),
new DataColumnFixed("name", Cardinality.OPTIONAL, Type.STRING),
new DataColumnFixed("geometry", Cardinality.OPTIONAL, Type.GEOMETRY)));
DataTable cityDataTable = new DataTableImpl(
DataTable cityDataTable = new BaremapsDataTable(
cityRowType,
new IndexedDataList<>(new AppendOnlyLog<>(new RowDataType(cityRowType))));
cityDataTable.add(new DataRowImpl(cityDataTable.schema(),
Expand All @@ -91,7 +92,7 @@ void test() throws SQLException {
DataSchema populationRowType = new DataSchemaImpl("population", List.of(
new DataColumnFixed("city_id", Cardinality.OPTIONAL, Type.INTEGER),
new DataColumnFixed("population", Cardinality.OPTIONAL, Type.INTEGER)));
DataTable populationDataTable = new DataTableImpl(
DataTable populationDataTable = new BaremapsDataTable(
populationRowType,
new IndexedDataList<>(new AppendOnlyLog<>(new RowDataType(populationRowType))));
populationDataTable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

import java.util.Iterator;
import java.util.List;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.data.storage.DataColumn.Cardinality;
import org.apache.baremaps.data.storage.DataColumn.Type;
import org.apache.baremaps.store.*;
import org.apache.baremaps.store.DataColumn.Cardinality;
import org.apache.baremaps.store.DataColumn.Type;
import org.locationtech.jts.geom.Coordinate;

public class MockDataTable implements DataTable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import java.io.IOException;
import java.util.List;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.store.*;
import org.junit.jupiter.api.*;
import org.locationtech.jts.geom.Point;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import org.apache.baremaps.data.storage.*;
import org.apache.baremaps.store.*;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

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

import org.apache.baremaps.data.storage.DataStoreException;
import org.apache.baremaps.database.PostgresContainerTest;
import org.apache.baremaps.storage.MockDataTable;
import org.apache.baremaps.store.DataStoreException;
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 @@ -21,9 +21,9 @@
import static org.junit.jupiter.api.Assertions.*;

import java.util.List;
import org.apache.baremaps.data.storage.DataRowImpl;
import org.apache.baremaps.database.PostgresContainerTest;
import org.apache.baremaps.storage.MockDataTable;
import org.apache.baremaps.store.DataRowImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down
4 changes: 4 additions & 0 deletions baremaps-flatgeobuf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.apache.baremaps</groupId>
<artifactId>baremaps-store</artifactId>
</dependency>
<dependency>
<groupId>org.apache.baremaps</groupId>
<artifactId>baremaps-testing</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.baremaps.storage.flatgeobuf;
package org.apache.baremaps.flatgeobuf.store;

import java.io.IOException;
import java.nio.file.Files;
Expand Down
Loading

0 comments on commit 86065fc

Please sign in to comment.