Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 48798

Python is an open source interpreted programming language used in many GIS programs.

1 vote
0 answers
1k views

How to periodically flush in-memory rasters with GDAL Python bindings?

Sometimes Python will crash, sometimes it won't. … Is it possible to do this in GDAL (Python bindings)? If so, how? …
wfgeo's user avatar
  • 3,628
4 votes
1 answer
2k views

Making multiple convex hulls in a GeoDataFrame based on a categorical attribute in GeoPandas

Suppose I have a GeoDataFrame as follows: | cat | geom ----+--------+------------- 0 | 0 | POINT(0, 0) 1 | 0 | POINT(0, 1) 2 | 0 | POINT(1, 1) 3 | 0 | POINT(1, 0) …
wfgeo's user avatar
  • 3,628
2 votes

Adding GeoPandas Dataframe to PostGIS table?

I have a solution which is requires only psycopg2 and shapely (in addition geopandas of course). It is generally bad practice to iterate through (Geo)DataFrame objects because it is slow, but for smal …
wfgeo's user avatar
  • 3,628
1 vote

GeoPandas does not identify points inside polygon

@jdmcbr's explanation helped me solve the issue but I did so in a different way because my input data were lines, not points. A spatial join would not have been sufficient because I wanted to know whi …
wfgeo's user avatar
  • 3,628
0 votes
1 answer
758 views

Getting GeoJSON formatted properly for Leaflet?

I am trying to get data put on a leaflet map that I have set up. I am following this tutorial: https://www.youtube.com/watch?v=fDfkjx-VhLI I have all of the html, css and js scripts up and running, …
wfgeo's user avatar
  • 3,628
1 vote

Get just not null values from intersection of shapefile and buffer with Python

See here for more info about what is truthy and falsey in Python. By the way, it is not recommended to iterate through lists the way you are doing in Python. …
wfgeo's user avatar
  • 3,628
2 votes
1 answer
782 views

Cannot find python executable being used by QGIS [closed]

I am trying to develop a plugin for QGIS but I am having trouble setting up my IDE with the required python executable so I can get a console working for logging output while developing it. … But when I navigate to this directory and list the contents, I don't see any python executable. Shouldn't there be one in here? I am using Ubuntu 16.04. …
wfgeo's user avatar
  • 3,628
4 votes
1 answer
1k views

Open a numpy array as a GDAL raster in memory

The reason for this is that there is a very good algorithm that we found that is written using the Python GDAL bindings, and so we have to switch from rasterio to pure GDAL for this part But it seems …
wfgeo's user avatar
  • 3,628
5 votes
Accepted

Open a numpy array as a GDAL raster in memory

It turns out it was a rather simple goof. Memory is the keyword for an in-memory vector dataset, while MEM is the keyword for an in-memory raster dataset. I even linked the page for vector datasets in …
wfgeo's user avatar
  • 3,628
0 votes

Finding nearest point in other GeoDataFrame using GeoPandas

This solution is extremely inefficient but it should work for any and all geometry types (including mixed geometry type gdfs). I would only try this if your gdfs are small (my use case was a gdf with …
wfgeo's user avatar
  • 3,628
0 votes

How to inverse the orientation of the holes coordinates of a polygon in geopandas

import geopandas as gpd from shapely.geometry import Polygon # Initializing a polygon with two holes # See: https://stackoverflow.com/questions/48770822/how-to-make-holes-in-a-polygon-in-shapely-python-having-polygons … reversed_interior_polys) # Reconstruct the original polygon from the list reversed polygons we just made # See (again): https://stackoverflow.com/questions/48770822/how-to-make-holes-in-a-polygon-in-shapely-python-having-polygons …
wfgeo's user avatar
  • 3,628
0 votes

Rounding coordinates to five decimals in GeoPandas

gdf_rounded = gdf.round(5) Rounds the coordinates to 5 decimal places
wfgeo's user avatar
  • 3,628
1 vote

GDAL polygonize lines

Thanks @ustroetz for your excellent answer, it really helped me a lot. I will share an adjustment and extra step I implemented to remove the unsightly loops that appear as a consequence of the process …
wfgeo's user avatar
  • 3,628
1 vote

Shortest path touching all points

This is a python codebase which tries to draw the shortest network possible connecting points: https://github.com/facebookresearch/many-to-many-dijkstra The only limitation is that the output will be a …
wfgeo's user avatar
  • 3,628