Skip to content

mvt encoding with null properties crashes #77

@nicklasaven

Description

@nicklasaven

If I try to create a mapbox vector tile from geojson that contains properties with null values it panics.

Example:

	func main(){
		rawJSON := []byte(`
		{ "type": "FeatureCollection",
		"features": [
		  { "type": "Feature",
			"geometry": {"type": "Point", "coordinates": [1, 1]},
			"properties": {"test": null}
		  }
		]
		}`)
		collections := map[string]*geojson.FeatureCollection{}
		fc, _ := geojson.UnmarshalFeatureCollection(rawJSON)

		collections["test"] = fc
		layers := mvt.NewLayers(collections)

		layers.ProjectToTile(maptile.New(0,0,0))

		data, err := mvt.Marshal(layers)

		if err != nil{
			fmt.Errorf("Error: %v\n", err)
		}
		base64 := base642.StdEncoding.EncodeToString(data)
		fmt.Printf("%s\n", base64)
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions