0

I have a GeoPandas dataframe:

self.geopd = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.Longitude, df.Latitude))

       Angle of point   Latitude  Longitude                   geometry
0           90.010591  32.959723  35.808097  POINT (35.80810 32.95972)
1           89.825599  32.959723  35.809097  POINT (35.80910 32.95972)
2           89.640612  32.959723  35.810097  POINT (35.81010 32.95972)
3           89.455632  32.959723  35.811097  POINT (35.81110 32.95972)
4           89.270664  32.959723  35.812097  POINT (35.81210 32.95972)
...               ...        ...        ...                        ...
78817      176.937825  33.219723  36.105097  POINT (36.10510 33.21972)
78818      176.937291  33.219723  36.106097  POINT (36.10610 33.21972)
78819      176.936757  33.219723  36.107097  POINT (36.10710 33.21972)
78820      176.936222  33.219723  36.108097  POINT (36.10810 33.21972)
78821      176.935688  33.219723  36.109097  POINT (36.10910 33.21972)

[78822 rows x 4 columns]

I want to use Folium to choropleth to plot all the points by the angle of point values.

But I only want some of them, meaning:

Plot only the points where angle of point is between 50-150 and in another color all the points where Angle of point is between 88-98.

So far, My idea was to create a new data frame for each condition and plot them, but it's not possible.

And, my output for some reason is plotted in Markers and not color, How do I change it?

self.optimal_gdf = (self.geopd[(self.geopd['Angle of point'] >= 88) & (self.geopd['Angle of point'] <= 100)])
self.optimal_gdf.crs = {'init': 'epsg:4326'}


f_map = folium.Map(
            location=[midlat, midlon],
            tiles='Stamen Terrain',
            zoom_start=10
        )

        folium.Marker(
            location=[gdt1[0], gdt1[1]],
            popup='GDT1'.format(gdt1),
            icon=folium.Icon(color='red')
        ).add_to(f_map)

        folium.Marker(
            location=[gdt2[0], gdt2[1]],
            popup='GDT2'.format(gdt2),
            icon=folium.Icon(color='red')
        ).add_to(f_map)

        folium.Marker(
            location=[target[0], target[1]],
            popup='Target Area'.format(target),
            icon=folium.Icon(color='red')
        ).add_to(f_map)

        folium.Choropleth(
            self.optimal_gdf,
            key_on='feature.properties.name',
            fill_color='YlOrRd',
            fill_opacity=0.7,
            line_opacity=0.2
        ).add_to(f_map)
        f_map.save('in5.html')

the output is this: output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.