[Doc] Documentation for accessing properties in a GeoJsonLayer lacking important information.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 14.6k
- Forks
- 2.3k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 42
Description
Original Title: [Feat] pydeck.Layer support for geojson.FeatureCollection in 'GeoJsonLayer'
This issue was updated as I figured out why I was having issues with this. See the comment below.
Old Text:
Target Use Case
Passing a python-geojson geojson.FeatureCollection to pydeck directly.
gj = geojson.FeatureCollection([geojson.Feature(geojson.Point((0, 0)))])
layer = pydeck.Layer(
type="GeoJsonLayer",
data=gj,
)
Proposal
I think this should be supported as it is a GeoJsonLayer it should accept any valid geojson.
It works if the object is a python dict that could be loaded to the geojson with geojson.loads(geojson.dumps(data)) but it does not work with the geojson object of that data.
It does however works if you do not pass the full FeatureCollection but only its features list.
gj = geojson.FeatureCollection([geojson.Feature(geojson.Point((0, 0)))])
layer = pydeck.Layer(
type="GeoJsonLayer",
data=gj.features,
)
Which is why I think it should also be supported to just pass the FeatureCollection.
It actually works to pass the FeatureCollection to pydeck. But it leads to errors if any of the keyword args are trying to access any data of a feature. So setting line color with get_line_color="[255, 0, properties.growth*255]" for example will break the output.
EDIT: This is more of an Issue than I realized at the time. When passing only the features array access to the properties from the styling functions works. So get_line_color and so on. But the DeckGL object cannot access the properties for use in the Tooltip function. When passing the geojson.FeatureCollection access from the tooltip function works. But you can not use the properties in get_line_color and similar keywords.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pydeck.Layer entry point and the GeoJsonLayer behavior described in the issue, comparing FeatureCollection input with its features array. Document which property-access behavior applies to styling expressions such as get_line_color and to the Tooltip function, and make the supported usage clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- data-visualization, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100