I have the following geojson element. When I add these and many others to a geojsonview, the stroke color is correct but the fill stays empty. According to the documentation, it should be supported. Does anybody know what I am doing wrong?
We use viktor SDK: 14.11.0 on python 3.10
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [[[6.099592460648699, 52.33009087363639], [6.099145164816067, 52.33057647596469], [6.099607960629977, 52.33105659750646], [6.100518061785403, 52.3310511114381], [6.100965347333358, 52.33056550398212], [6.100502542010893, 52.33008538772219], [6.100949818050788, 52.32959978025025], [6.10048702301297, 52.32911966382001], [6.099576961443019, 52.32912514958005], [6.099129675118972, 52.3296107519245], [6.099592460648699, 52.33009087363639]]]
},
"properties": {
"description": "Rijntakken",
"stroke": "#0066cc",
"fill": "#0066cc"
}
}
Hi Vincent,
When I add your example to a view it gives me proper fill:
from viktor import ViktorController
from viktor.parametrization import ViktorParametrization
from viktor.views import GeoJSONView, GeoJSONResult
class Parametrization(ViktorParametrization):
pass
class Controller(ViktorController):
label = 'My Entity Type'
parametrization = Parametrization
@GeoJSONView("My view", duration_guess=1)
def get_view(self, params, **kwargs):
d = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [[[6.099592460648699, 52.33009087363639],
[6.099145164816067, 52.33057647596469],
[6.099607960629977, 52.33105659750646],
[6.100518061785403, 52.3310511114381],
[6.100965347333358, 52.33056550398212],
[6.100502542010893, 52.33008538772219],
[6.100949818050788, 52.32959978025025],
[6.10048702301297, 52.32911966382001],
[6.099576961443019, 52.32912514958005],
[6.099129675118972, 52.3296107519245],
[6.099592460648699, 52.33009087363639]]]
},
"properties": {
"description": "Rijntakken",
"stroke": "#0066cc",
"fill": "#0066cc"
}
}
]
}
return GeoJSONResult(d)
I really just discovered the mistake. One of the polygons has the wrong CRS. As a result, the geojson view lost control somehow. I just set it to the correct CRS and now it works indeed.