I’m trying to create an interactive map for a GeoJSONView, and according to the docs I have to give an identifier to each geometric object, e.g.
point_1 = MapPoint(..., identifier="point1")
However, this doesn’t seem to be working for GeoJSONView. Some context: I create a GeoDataFrame with several columns (including “stroke” and “type” etc., all properties which are used for plotting). Then I convert this to a GeoJSON and return it as GeoJSONResult. I tried adding “identifier” as a column, like I did with other properties, but this doesn’t seem to work. Should I do it differently?
Thank you for your question. As you noticed, it is not documented how to use map select interaction for a GeoJSONResult. We will fix this. The identifier can be added to the raw json with “id” on the same level as “type” within a feature:
"id": "my identifier",
I have no experience with geopandas.GeoDataFrame, but I can imagine that it is possible to add such a keyword by adding a column?
Adding a column called “id” (instead of “identifier”) to the GeoDataFrame was the solution! Thanks for your help.