Skip to content
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

Points only #948

Open
gguandf opened this issue Sep 30, 2022 · 9 comments
Open

Points only #948

gguandf opened this issue Sep 30, 2022 · 9 comments

Comments

@gguandf
Copy link

gguandf commented Sep 30, 2022

First - thanks for this powerful library.

I'm trying to create an mbtile-file with tippecanoe.
The base is a geojson with 64800 points.
Each point has coordinates and a value.

like:

{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 6.0, -89.5 ] }, "properties": { "value": -53.0 } },

Question 1: can this work?
Question2: can tippecanoe deal with points only?

The problem: When the mbtile-file is loaded into SQLite-Viewer, metadata and tiles (binary) are shown but no images!?
It is similar with tileserver-php-master - no images are loaded.

Any ideas what i'm doing wrong?
The goal is to show all GeoJson points in a leaflet map.
But with tiles which are loaded when zooming and scrolling - and not with one giant geojsons file.

@e-n-f
Copy link
Contributor

e-n-f commented Sep 30, 2022

Thanks! Tippecanoe development is now taking place in https://github.com/felt/tippecanoe.

Features like these should work with Tippecanoe. Tippecanoe can deal with points, LineStrings, and Polygons.

Tippecanoe creates vector tiles; it is necessary to use a renderer to see the output as images. You can for instance use Protomaps or Mapbox GL.

@gguandf
Copy link
Author

gguandf commented Oct 3, 2022

Hi, thanks for your answer.

I'm wondering how to display the *.mbtiles-files in a leaflet-map.
I allready tried TileLayer.MBTiles.js!

If I view the *.mbtiles-file in SQLite Viewer the format is 'pbf' !?!
My leaflet-map is empty (in each zoom-level) - only the background-map (osm) is shown.

No JS-errors are returned.

kind regards.

@e-n-f
Copy link
Contributor

e-n-f commented Oct 3, 2022

I am no expert on Leaflet, but apparently there is a plugin to display vector tiles.

The "pbf" refers to the format defined here, which is based upon Protocol Buffers.

@gguandf
Copy link
Author

gguandf commented Oct 4, 2022

Hello Erica, thanks again.

You steered me in the right direction!

With 'Leaflet.VectorGrid.bundled.js' and Tile-Sever
now I can display the *.mbtiles as '{z}/{x}/{y}.pbf' on my leaflet-map.

Now I have to style the vector tiles - this can be done with the 'vectorTileLayerStyles' option.
I.e. each layer can have its own style variants.

The goal is an mbtiles file with several layers.
Is this possible with tippecanoe?

Kind regards.

@e-n-f
Copy link
Contributor

e-n-f commented Oct 5, 2022

Yes, if you supply multiple .json source files, each will be placed in its own layer, or you can use the -L option to associate sources with layers, or you can use the "tippecanoe": { "layer": name } field in a feature to specify its layer.

@gguandf
Copy link
Author

gguandf commented Oct 5, 2022

OK. I understand that I can put different JSON source files in different layers.
But can I only use one JSON file and assign different layer names based on the attribute (property) value?

eg:
Values from 4 to 8 Layer-Name-X
Values from 8 to 12 Layer-Name-Y

eg.

{
   "type": "FeatureCollection",
   "features": [
     {
       "type": "feature",
       "geometry": {
         "type": "Point",
         "coordinates": [
           150.0,
           90.0
         ]
       },
       "properties": {
         "value": 8.0
       }
     },
     {
       "type": "feature",
       "geometry": {
         "type": "Point",
         "coordinates": [
           151.0,
           90.0
         ]
       },
       "properties": {
         "value": 10.0
       }
     }
]

@e-n-f
Copy link
Contributor

e-n-f commented Oct 5, 2022

Tippecanoe does not have the ability to filter layers by attribute value. You would have do something like:

{"type":"Feature","tippecanoe":{"layer":"one"},"geometry":{"type":"Point","coordinates":[150,45]},"properties":{"value":8}}
{"type":"Feature","tippecanoe":{"layer":"two"},"geometry":{"type":"Point","coordinates":[151,45]},"properties":{"value":10}}

to explicitly tag each feature with its layer.

@gguandf
Copy link
Author

gguandf commented Oct 6, 2022

Thanks again!
I already found the layer-solution you mentioned in your last answer! great!

Hopefully my last problem/question:

I use this tippicanoe command to create mbtiles:
tippecanoe --force -o 05/05.mbtiles --minimum-zoom=4 --maximum-zoom=9 --drop-densest-as-needed -rg 05/05.geojson

But when I inspect (with the SQLite browser) the mbtiles file, the metadata.generator_options says:
tippecanoe --force -o 05/05.mbtiles '--minimum-zoom=4' '--maximum-zoom=9' --drop-densest-as-needed -rg 05/05.geojson

Please note the quotation marks at minimum and maximum!!!

These quotes are the problem!
My TileServer says the mbtiles file is not well-formed - because of the quotes.

Do you have any idea?
What does the tippecanoe command have to look like to get a valid mbtiles file?

@e-n-f
Copy link
Contributor

e-n-f commented Oct 7, 2022

I wrote the latest revision of the mbtiles spec, so I think TileServer is wrong, not tippecanoe, but if it doesn't like the generator_options, you can comment out this block of code and not include it in the metadata:

https://github.com/felt/tippecanoe/blob/182093bdc78d0a0adc65d24c9cbbe93eecaa38cf/mbtiles.cpp#L450-L457

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants