question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Read GeoJSON style from file as default

See original GitHub issue

We have a template (geojson_style.js) for styling the GeoJSON object.

function {{ style }}(feature) {
    return {
        {%- if quantize_fill %}
        fillColor: {{ quantize_fill }},
        {%- else %}
        fillColor: '{{ fill_color }}',
        {%- endif %}
        weight: {{ line_weight }},
        opacity: {{ line_opacity }},
        color: '{{ line_color }}',
        fillOpacity: {{ fill_opacity }}
    };
}

The template is filled here and that usually happens with the default values. But if the GeoJSON file has properties defined a simple function style_1(feature) {return feature.properties;} would suffice and, in same cases, that is the expected behavior.

I would like to discuss here the possibility of making “reading from properties” the default behavior instead of the default values we have and leave the kwargs as an override option.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ocefpafcommented, Feb 3, 2017

@ocefpaf Sorry I just followed the rabbit hole of issues to get to this point. Does this mean there is no implementation for popups on geojson layers?

I plan to work on this soon, unless someone beats me to it.

0reactions
jzf2101commented, Aug 1, 2017

Any news on this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

GeoJSON Styling information - GIS Stack Exchange
For GeoJSON - CSS styles are used to modify your points, line, ... OPTIONAL: default "555555" // the color of a line as...
Read more >
Is it possible to extract style information from GeoJson for an ...
I am able to create a vector layer from this geojson in an openlayers map, but unable to utilize the styling properties.
Read more >
Load data from an external GeoJSON file | Mapbox GL JS
This example adds GeoJSON data from an external file and uses it in a layer on the map. ... setFog({}); // Set the...
Read more >
Using GeoJSON with Leaflet
The GeoJSON layer​​ GeoJSON objects are added to the map through a GeoJSON layer. To create it and add it to a map,...
Read more >
An Update to Working with GeoJSON in the Browser | HERE
Reader('/path/to/geojson/file.json'); reader.parse(); map. ... One possible issue with this code block is that uses the default the marker ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found