geopandas

Accessing package in python virtual environment

拟墨画扇 提交于 2020-03-25 18:41:45
问题 I have a virtual environment in which I have installed 'geopandas'. When I do a pip list it lists this package as well. But when I try to call it in my jupyter notebook via 'import geopandas' I get a ModuleNotFoundError. Please help - I'm using windows machine 回答1: You can verify that your notebook is running in the correct virtual environment by doing: import sys sys.version Here's how to run a Jupyter notebook in a virtualenv. 回答2: You should check if your notebook is using the correct

Extract constrained polygon using OSMnx

自闭症网瘾萝莉.ら 提交于 2020-03-22 09:48:26
问题 I'm playing around with OSMnx package in order to solve the following task: - there is a point X on the map defined by latitude and longitude - we need to detect a polygon that contains that point X and is constrained by the neighboring roads - so basically the point X is inside the polygon and the neighboring roads will be borders of that polygon. So far I've managed only to plot the visualization of the graph on the map and find the closest edge/node to point X. In the attached image I've

Why does `conda update --all` not update all?

点点圈 提交于 2020-03-22 06:42:08
问题 Similar to this question, but there's no answer there. I installed anaconda , and then conda install -c conda-forge geopandas . When I ran import geopandas , I got >>> import geopandas as gpd anaconda3/envs/gis/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(*args, **kwds) So, I tried updating all packages of my Anaconda env like conda update --all , but that didn't solve the warnings. What

Geopandas set geometry: ValueError for MultiPolygon “equal len keys and value”

风格不统一 提交于 2020-03-03 20:31:32
问题 I have 2 geodataframes with a geometry column and I copy some geometries from 1 to the other. This works well with Polygons but returns a ValueError for any (valid) MultiPolygon. Please advice how to solve this? I don't know if / how / why I should change the MultiPolygon to get "equal len keys and value"? geodata01.loc[index, 'geometry'] = geodata02.loc[index, 'geometry'] This works well with Polygons. Only with MultiPolygons I get: ValueError if len(labels) != len(value): --> 611 raise

Geopandas set geometry: ValueError for MultiPolygon “equal len keys and value”

妖精的绣舞 提交于 2020-03-03 20:26:42
问题 I have 2 geodataframes with a geometry column and I copy some geometries from 1 to the other. This works well with Polygons but returns a ValueError for any (valid) MultiPolygon. Please advice how to solve this? I don't know if / how / why I should change the MultiPolygon to get "equal len keys and value"? geodata01.loc[index, 'geometry'] = geodata02.loc[index, 'geometry'] This works well with Polygons. Only with MultiPolygons I get: ValueError if len(labels) != len(value): --> 611 raise

Geopandas set geometry: ValueError for MultiPolygon “equal len keys and value”

半城伤御伤魂 提交于 2020-03-03 20:26:10
问题 I have 2 geodataframes with a geometry column and I copy some geometries from 1 to the other. This works well with Polygons but returns a ValueError for any (valid) MultiPolygon. Please advice how to solve this? I don't know if / how / why I should change the MultiPolygon to get "equal len keys and value"? geodata01.loc[index, 'geometry'] = geodata02.loc[index, 'geometry'] This works well with Polygons. Only with MultiPolygons I get: ValueError if len(labels) != len(value): --> 611 raise

Geopandas Dataframe Points to Polygons

╄→尐↘猪︶ㄣ 提交于 2020-02-27 08:09:14
问题 I have a geopandas dataframe made up of an id and a geometry column which is populated by 2D points. I want to join the points for each unique id to create a polygon, so that my new dataframe will have polygons as its geometry. My code currently looks something like this: polygons = geopandas.GeoDataFrame() for i in id: group = df[df['id']== i] polygon = {'type': 'Polygon', 'coordinates': group['geometry']} polygon['poly'] = polygon polygons = geopandas.concat([polygon,polygons]) It creates a

Loading JSON into a GeoDataFrame

…衆ロ難τιáo~ 提交于 2020-02-26 12:11:36
问题 I'm having difficulty loading the following JSON containing GIS data (https://data.cityofnewyork.us/resource/5rqd-h5ci.json) into a GeoDataFrame. The following code fails when I try to set the geometry. import requests import geopandas as gpd data = requests.get("https://data.cityofnewyork.us/resource/5rqd-h5ci.json") gdf = gpd.GeoDataFrame(data.json()) gdf = gdf.set_geometry('the_geom') gdf.head() 回答1: Setting the geometry fails because the geopandas.GeoDataFrame constructor doesn't appear

How do I plot a “differences” map using geopandas and mapclassify?

*爱你&永不变心* 提交于 2020-02-25 05:54:24
问题 I have a GeoDataFrame with a "differences" column that stores the delta between two numbers. Sometimes these numbers are positive, negative or zero if there is not difference. I need to make a choropleth map that has some divergent colormap with 0 (or some middle buffer) as the midpoint and non-symetrical colorbar, for example [ -0.02, -0.01, 0., 0.01, 0.02, 0.03 ]. I've experimented with class MidPointNormalize(mp.colors.Normalize): def __init__(self, vmin=None, vmax=None, midpoint=None,

Convert GeoDataFrame polygons to kml file

空扰寡人 提交于 2020-02-06 03:54:48
问题 I have a geopandas GeoDataFrame with various polygons and colors that I'm using to plot meteorological data (another question I asked here): color geometry 0 #fbfdd1 (POLYGON ((-97.12191717810094 32.569, -97.1194... 1 #f3fabf (POLYGON ((-97.12442748846019 32.569, -97.1219... 2 #ebf7b1 (POLYGON ((-97.12944810917861 32.569, -97.1269... 3 #daf0b2 (POLYGON ((-97.18969555780023 32.569, -97.1879... 4 #cbeab3 (POLYGON ((-97.18969555780023 32.5710632999095... 5 #afdfb6 (POLYGON ((-97.18467493708175