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

GeoJson Feature property with null value becomes "null" as string literal when querying rendered features #9968

Closed
Bernoulli-IT opened this issue Sep 9, 2020 · 1 comment

Comments

@Bernoulli-IT
Copy link

mapbox-gl-js version: 1.11.0

browser: Chrome

Steps to Trigger Behavior

  1. Set source data with a GeoJson FeatureCollection
  2. The collection contains at least one feature with a property with a null value
  3. Query rendered features and inspect the property, its value has become a literal "null" string

Expected Behavior

The value should remain as null.

Actual Behavior

The value became "null" as a literal string.

Example

Start of a GeoJson file.

{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "NLWMO002360566200097",
"properties": {
"bridgeDetails.vild": null,
...

Property inspected with Chrome inspector:

bridgeDetails.vild: "null"

Is this behavior by design? It looks odd. And needs some additional client-side cumbersome handling when expecting feature properties to be possibly null instead of "null".

@Bernoulli-IT Bernoulli-IT changed the title GeoJson Feature property with null value becomes "null" as a string when querying rendered features GeoJson Feature property with null value becomes "null" as string literal when querying rendered features Sep 9, 2020
@ryanhamley
Copy link
Contributor

This is a duplicate of #8497 Closing to focus discussion there

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