-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for PMTiles #794
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
public List<Entry> getDirectory(long offset, int length) { | ||
var header = getHeader(); | ||
try (var input = Files.newInputStream(path)) { | ||
input.skip(offset); |
Check notice
Code scanning / CodeQL
Ignored error status of call Note
// Write the tile | ||
var tileId = PMTiles.zxyToTileId(z, x, y); | ||
var tileLength = bytes.length; | ||
Long tileHash = Hashing.farmHashFingerprint64().hashBytes(bytes).asLong(); |
Check warning
Code scanning / CodeQL
Boxed variable is never null Warning
|
||
@Test | ||
void encodeHeader() throws IOException { | ||
var etag = "1"; |
Check notice
Code scanning / CodeQL
Unread local variable Note test
baremaps-core/src/test/java/org/apache/baremaps/tilestore/pmtiles/PMTilesTest.java
Fixed
Show fixed
Hide fixed
baremaps-core/src/main/java/org/apache/baremaps/tilestore/pmtiles/PMTilesReader.java
Fixed
Show fixed
Hide fixed
void decodeHeader() throws IOException { | ||
var file = TestFiles.resolve("pmtiles/test_fixture_1.pmtiles"); | ||
try (var channel = FileChannel.open(file)) { | ||
var input = new LittleEndianDataInputStream(Channels.newInputStream(channel)); |
Check warning
Code scanning / CodeQL
Potential input resource leak Warning test
long numEntries = readVarInt(buffer); | ||
List<Entry> entries = new ArrayList<>((int) numEntries); | ||
long lastId = 0; | ||
for (int i = 0; i < numEntries; i++) { |
Check failure
Code scanning / CodeQL
Comparison of narrow type with wide type in loop condition High
expression
expression
entry.setTileId(lastId); | ||
entries.add(entry); | ||
} | ||
for (int i = 0; i < numEntries; i++) { |
Check failure
Code scanning / CodeQL
Comparison of narrow type with wide type in loop condition High
expression
expression
long value = readVarInt(buffer); | ||
entries.get(i).setRunLength(value); | ||
} | ||
for (int i = 0; i < numEntries; i++) { |
Check failure
Code scanning / CodeQL
Comparison of narrow type with wide type in loop condition High
expression
expression
long value = readVarInt(buffer); | ||
entries.get(i).setLength(value); | ||
} | ||
for (int i = 0; i < numEntries; i++) { |
Check failure
Code scanning / CodeQL
Comparison of narrow type with wide type in loop condition High
expression
expression
SonarCloud Quality Gate failed. 1 Bug No Coverage information Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Enable the export of vector tiles in the PMTiles format. Most of the necessary functions have been ported from [go-pmtiles](https://github.com/protomaps/go-pmtiles) to Java.
Enable the export of vector tiles in the PMTiles format. Most of the necessary functions have been ported from [go-pmtiles](https://github.com/protomaps/go-pmtiles) to Java.
Enable the export of vector tiles in the PMTiles format. Most of the necessary functions have been ported from [go-pmtiles](https://github.com/protomaps/go-pmtiles) to Java.
@bchapuis Thanks for the great work! Really looking forward to this feature. When will this be released? |
In addition, is it possible that I use it directly with JTS geometries instead of always converting from existing vector tiles? |
I'd like to start the release process soon, so I hope to have a release by the end of january. Note that, while the demonstration works fine, some small issues remain. For instance, the number of tiles in the metadata does not match the number of actual tiles. If you have experience with this format, any help, like spotting or fixing issues in the codec is welcome (I have no prior experience with this format) 😅 |
I'm not sure to fully understand this question. We do have an efficient reader for planet osm based on the Stream API that supports the xml, pbf, and osc formats. Optionnally, this reader can produce JTS geometries. We use it to import the data in postgresql, which is then used to produce the vector tiles. Are you thinking about accessing this Stream of geometries? |
No description provided.