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

properties with null values get dropped #114

Closed
stvno opened this issue Nov 13, 2015 · 7 comments
Closed

properties with null values get dropped #114

stvno opened this issue Nov 13, 2015 · 7 comments

Comments

@stvno
Copy link

stvno commented Nov 13, 2015

I've got a large GeoJSON with 1014963 features with several properties which contain NULL values together with actual numeric values. These properties get (silently) dropped from the resulting mbtiles.

Feature with a gloei-value:

{ "type": "Feature",
   "properties": 
      { "id": 10596379, "gloei": 1 }, 
  "geometry": 
     { "type": "MultiPolygon", "coordinates": [ [ [ [ <geom> ] ] ] ] }
},

and without

{ "type": "Feature",
   "properties": 
      { "id": 10615538,  "gloei": null },
   "geometry": 
      { "type": "MultiPolygon", "coordinates": [ [ [ [<geom> ] ] ] ] } 
}

I specifically told tippecanoe to include 'gloei':
./tippecanoe -o licht2.mbtiles out.json -y gloei

However the resulting mbtiles doesn't include the gloei property
This is its tilejson, courtesy of tessera:

{"scheme":"tms","basename":"licht2.mbtiles","id":"licht2","filesize":218353664,"name":"licht2.mbtiles","description":"licht2.mbtiles","version":"1","minzoom":0,"maxzoom":14,"center":[5.174561,52.221069,14],"bounds":[3.358925,50.750881,7.225992,53.534755],"type":"overlay","format":"pbf",
"vector_layers":[
    {"id":"out",
      "description":"",
      "minzoom":0,
       "maxzoom":14,
       "fields":{}
     }],
"tiles":["http://10.10.0.12:9001/{z}/{x}/{y}.pbf"],"tilejson":"2.0.0"}
@e-n-f
Copy link
Contributor

e-n-f commented Nov 13, 2015

As far as I know there's no way to represent a null value in the vector tile format, so that's why it doesn't include the null property for the features that have "gloei": null.

I am surprised, though, that you are not seeing it as a Number in the tilejson for the features that do have no-null values. I just tried

{ "type": "Feature", "properties": { "gloei": 3 }, "geometry": { "type": "Point", "coordinates": [ -122, 37 ]} }
{ "type": "Feature", "properties": { "gloei": null }, "geometry": { "type": "Point", "coordinates": [ -121, 37 ]} }

with

tippecanoe -f -o nullprop.mbtiles nullprop.json

and got the expected metadata:

$ sqlite3 nullprop.mbtiles
SQLite version 3.8.5 2014-08-15 22:37:57
Enter ".help" for usage hints.
sqlite> select * from metadata;
name|nullprop.mbtiles
description|nullprop.mbtiles
version|1
minzoom|0
maxzoom|14
center|-122.000000,37.000000,14
bounds|-122.000000,37.000000,-121.000000,37.000000
type|overlay
format|pbf
json|{"vector_layers": [ { "id": "nullprop", "description": "", "minzoom": 0, "maxzoom": 14, "fields": {"gloei": "Number"} } ] }

with gloei declared as a Number in the json. Do you have a sample of your GeoJSON input that demonstrates the problem?

@stvno
Copy link
Author

stvno commented Nov 13, 2015

The whole GeoJSON file is 2.8GB which is a bit big to attach here, but I created a new GeoJSON from the first few features and annoyingly that one works fine; it does show all the properties. I'll try some more to see if I can create a small but failing geojson.

@stvno
Copy link
Author

stvno commented Nov 13, 2015

After working my way through the large geojson I realised something went wrong with the export and all gloei values where null. I redid the export and now the gloei properties show up, so it was a mistake on my side and this issue can be closed.

@stvno stvno closed this as completed Nov 13, 2015
@e-n-f
Copy link
Contributor

e-n-f commented Nov 13, 2015

Great! Glad it is working for you now.

@clouddie
Copy link

@ericfischer Hi, just got caught by this as well, null properties are dropped (silently), non-null properties are kept. I understand this is the accepted behaviour.

For information, the library geojson-vt has a different behaviour : the null properties are kept and transformed to string "null"

@e-n-f
Copy link
Contributor

e-n-f commented Nov 21, 2016

Oh, thanks for pointing that out, @clouddie! I think Tippecanoe is following Mapnik's behavior with null properties, but it's good to know that geojson-vt is doing something different, so we can figure out what the right thing is to do and make everything behave the same.

@springmeyer
Copy link
Contributor

Correct, the spec does not currently keep null values, by design. This is being discussed at mapbox/vector-tile-spec#62.

ewsterrenburg pushed a commit to ewsterrenburg/tippecanoe that referenced this issue Dec 7, 2023
* Add CODEOWNERS

* Narrower list?
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

4 participants