geopandas

Geopandas world map in Polar Stereographic projection with coloured oceans

旧时模样 提交于 2019-12-11 04:19:41
问题 Adding a further requirement to this question, I also need to have the oceans in blue (or any other colour). For the 'PlateCarree' projection I can simply do this crs = ccrs.PlateCarree() crs_proj4 = crs.proj4_init world = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres")) w = world.to_crs(crs_proj4) g = w.plot(facecolor='sandybrown', edgecolor='black') And now adding the ocean colour g.set_facecolor('#A8C5DD') If I now want to use a polar stereographic peojection ccrs

Shapely contains(point) always gives False

我的未来我决定 提交于 2019-12-11 01:56:27
问题 I started working on geopandas and shapely today and I am trying to use the contains method to check if a point lies inside a polygon of geological constituency data from here. My code is: if janak.boundary.contains(cent_janak): print('True') else: print('False') where janak is a polygon from geometry data of a shapefile and cent_janak is the centroid of janak. To verify, I plotted them like this from descartes import PolygonPatch BLUE = '#6699cc' poly= janak fig = plt.figure() ax = fig.gca()

Python folium GeoJSON map not displaying

爱⌒轻易说出口 提交于 2019-12-10 17:44:05
问题 Good afternoon, I'm trying to use a combination of geopandas, pandas and folium to create a polygon map that I can embed incorporate into a web page. For some reason, it's not displaying and wonder if anyone can help. The steps I've taken: 1) Grabbed a .shp from the UK's OS for Parliamentary boundaries. 2) I've then used geopandas to change the projection to epsg=4326 and then exported as GeoJSON which takes the following format: { "type": "Feature", "properties": { "PCON13CD": "E14000532",

How to make tabular legend for geopandas plot

99封情书 提交于 2019-12-10 12:06:20
问题 I am plotting a choropleth map using geopandas and I need to plot a customized tabular legend. This question's answer shows how to obtain a tabular legend for a contourf plot. And I'am using it in the code bellow : import pandas as pd import pysal as ps import geopandas as gp import numpy as np import matplotlib.pyplot as plt pth = 'outcom.shp' tracts = gp.GeoDataFrame.from_file(pth) ax = tracts.plot(column='Density', scheme='QUANTILES') valeur = np.array([.1,.45,.7]) text=[["Faible","Ng<1,5"

Geopandas PostGIS connection

痞子三分冷 提交于 2019-12-09 06:15:36
问题 I recently started using Geopandas in python for some of my spatial work and am very pleased with it - I'm currently trying to read in PostGIS features and don't quite understand how to parameterize the database connection, and it didn't seem clear in the documentation: GeoDataFrame.from_postgis(sql, con, geom_col='geom', crs=None, index_col=None, coerce_float=True, params=None) This is likely a very simple question, all I wanted to know is what needs to go in 'con' - I assume a string with

Convert the coordinates of a shapefile in Geopandas

你说的曾经没有我的故事 提交于 2019-12-08 17:49:28
I am new at spatial analysis, but I cant find this answer anywhere. I have a list of post codes in CRS coordinates, latitude and longitude, and London's Boroughs shape file in OSN coordinates, and I would like to map them together, but this is what happens. This is the head of the postcodes london_post_codes.head() Out[81]: postcode latitude longitude 0 WD6 1GS 51.658021 -0.255663 1 WD17 1LA 51.660366 -0.397525 2 WC2N 6LE 51.509413 -0.121676 3 WC2N 6NA 51.508363 -0.124454 4 WC2N 6ND 51.508216 -0.123829 while this is the shape file read in geopandas borough = gpd.read_file('London_Borough

Colorbar on Geopandas

自作多情 提交于 2019-12-08 16:05:21
问题 I am trying to create a Matplotlib colorbar on GeoPandas. import geopandas as gp import pandas as pd import matplotlib.pyplot as plt #Import csv data df = df.from_csv('data.csv') #Convert Pandas DataFrame to GeoPandas DataFrame g_df = g.GeoDataFrame(df) #Plot plt.figure(figsize=(15,15)) g_plot = g_df.plot(column='column_name',colormap='hot',alpha=0.08) plt.colorbar(g_plot) I get the following error: AttributeError Traceback (most recent call last) <ipython-input-55-5f33ecf73ac9> in <module>()

Get latitude & longitude from address geopandas

为君一笑 提交于 2019-12-08 08:05:55
问题 I have a csv of about 100 million logs. Where one of the column is address and I am trying to get latitude and longitude of the address. I want to try something like mentioned in the Solution , But the solution given is arcGIS and that is a commercial tool. I did try google API that has limit of 2000 entries only. What is next best alternative to get address's Lat & Long into the large dataset. Input: The column Site is the address from the City Paris start_time,stop_time,duration,input

Problems with PyInstaller

妖精的绣舞 提交于 2019-12-08 02:41:51
问题 I would like to bundle an application into an executable using PyInstaller. I am having issues because of the geopandas library. Currently my script throwaway.py contains only the following import: import geopandas However running pyinstaller throwaway.py does not work. It appears to have problems with PyQt5 which only matplotlib imports. The log for pyinstaller is too long to include here however the following shows the last exception encountered: Exception: Cannot find existing PyQt5 plugin

Multi-Layer .gdb files in Python?

时光怂恿深爱的人放手 提交于 2019-12-07 10:42:08
问题 I'm trying to read in some .gdb files(folders?) from here: . I use GeoPandas and do the following: # file from local path mallard = gpd.read_file('./bird-species/E00039600_mallard.gdb/') # geopandas included map, filtered to just this hemisphere world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) westhem = world[(world['continent'] == 'North America') | (world['continent'] == 'South America')] # making sure the coordinates line up: mallard = mallard.to_crs(world.crs)