I am try to produce a choropleth figure by combining a geojson and pandas file where I want to show the Paddock and Area. The trouble is when I graph it 4 polygons are missing (incidentally the first three Paddocks (1a, 1b, 1c) and last Paddock (18) in the geojson file, and some of the polygons in the map are displaying Paddock Name and Area that are not aligned to the polygon. Any ideas what could be going wrong and how to fix?
gpd_farm = gpd.read_file('ward_thompson.geojson')
fig = px.choropleth(df_covers, geojson=gpd_farm, locations='Paddock', color='Area',
color_continuous_scale=px.colors.sequential.haline_r,
range_color=(0, 5),
labels={'Area':'Area'}
)
fig.update_geos(fitbounds="locations")
fig.update_layout(height=500, width=1000, margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
df_covers looks like this:
Paddock | Area |
---|---|
1a | 2.4 |
1b | 3 |
1c | 3.05 |
2 | 4 |
3 | 4.7 |
4 | 3.8 |
5 | 3.73 |
6 | 3.8 |
7 | 3.93 |
8 | 3.6 |
9 | 3.76 |
10 | 3.51 |
11 | 3.53 |
12 | 3.8 |
17 | 4.1 |
16 | 3.55 |
15 | 3.96 |
14 | 3.7 |
13 | 2.1 |
…
Here is an example of what is going wrong:
Here is an example of the first 4 features of the geojson file:
{“type”:“FeatureCollection”,“features”:[{“type”:“Feature”,“properties”:{“Paddock”:“1a”},“geometry”:{“type”:“Polygon”,“coordinates”:[[[175.3348606824875,-37.961468331277175],[175.33507525920868,-37.96152754340204],[175.33579409122467,-37.961684032359365],[175.33688306808472,-37.96067742188863],[175.33728003501892,-37.959772306575466],[175.33603012561798,-37.959755388426025],[175.3348606824875,-37.961468331277175]]]}},{“type”:“Feature”,“properties”:{“Paddock”:“1b”},“geometry”:{“type”:“Polygon”,“coordinates”:[[[175.3357994556427,-37.96182783272885],[175.33714056015015,-37.96228037911296],[175.3374034166336,-37.96248338966885],[175.33876597881317,-37.96358724974393],[175.33951699733734,-37.96238188446105],[175.33809542655945,-37.961887044563845],[175.33726394176483,-37.961624820360676],[175.33667922019958,-37.96149370790796],[175.33644318580627,-37.961375283555924],[175.33620178699493,-37.961430266314544],[175.3357994556427,-37.96182783272885]]]}},{“type”:“Feature”,“properties”:{“Paddock”:“1c”},“geometry”:{“type”:“Polygon”,“coordinates”:[[[175.33874988555905,-37.963633772217946],[175.34008026123044,-37.96472069799456],[175.340176820755,-37.964729156497825],[175.34042358398438,-37.96441196195856],[175.34094393253326,-37.96285980358953],[175.33952236175537,-37.96237342568741],[175.33874988555905,-37.963633772217946]]]}},{“type”:“Feature”,“properties”:{“Paddock”:2},“geometry”:{“type”:“Polygon”,“coordinates”:[[[175.3364539146423,-37.96136682466632],[175.33667385578156,-37.96149793734557],[175.33709228038788,-37.96156560831424],[175.3409492969513,-37.96285980358953],[175.34137845039368,-37.96195471517395],[175.3369688987732,-37.96069011034178],[175.33637344837186,-37.961278006266745],[175.3364539146423,-37.96136682466632]]]}},