Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Joris Van den Bossche
    @jorisvandenbossche
    check pygeos.geos_version
    Shirzart Enwer
    @Aniwax
    Yep, I am using 3.9.1 version. I will try out the grid_size parameter. Thanks @brendan-ward and @jorisvandenbossche
    Shirzart Enwer
    @Aniwax
    Hey guys, when approximately are you doing a new release, including pygeos.empty() ?
    Martin Fleischmann
    @martinfleis
    Hello, just a reminder that the community call starts in about 5 minutes
    Jacob Deppen
    @deppen8

    Hi team, asking here before I create an Issue.

    Short version: Is there a way to read a dictionary of valid GeoJSON directly into a GeoDataFrame?

    Longer version:
    I am getting some coordinates from an external service that look like this:

    boundary = {'type': 'MultiPolygon',
     'coordinates': [[[[-66.20854, -20.170393],
        [-66.198315, -20.170107],
        [-66.198168, -20.138717],
        [-66.209905, -20.13857],
        [-66.20854, -20.170393]]]]
    }

    I can put those in a dictionary to make valid GeoJSON like this:

    boundary_json = {
            "type": "FeatureCollection",
            "crs": {
                "type": "name",
                "properties": {"name": "urn:ogc:def:crs:OGC:1.3:CRS84"},
            },
            "features": [{"type": "Feature", "geometry": boundary}],
        }

    If I want to turn that into a GeoDataFrame though, it seems I either have to turn all of the features into shapely objects or, alternatively, save the file with json.dump("my_file.json") then gpd.read_file("my_file.json").

    Is there a way to skip that middle step if my dict is valid GeoJSON?

    Martin Fleischmann
    @martinfleis
    1 reply
    Joris Van den Bossche
    @jorisvandenbossche
    I will have to skip the geopandas-dask meeting tomorrow (teaching a full day, and probably just on time at home, but I have another (live) meeting after, so will want some time in between for dinner etc)
    Martin Fleischmann
    @martinfleis
    No problem.
    Shirzart Enwer
    @Aniwax

    Hi Team,

    I have a general question: when I apply pygeos.simplify(), does it check / guarantee the input/ output geometry shape is valid?

    Shirzart Enwer
    @Aniwax
    for example, I am constantly running into this
    pygeos.GEOSException: TopologyException: Ring edge missing at 56.906721425400001 29.747625114800002
    Brendan Ward
    @brendan-ward

    @Aniwax see the preserve_topology parameter: https://pygeos.readthedocs.io/en/latest/constructive.html#pygeos.constructive.simplify

    I think that parameter makes GEOS try to avoid validity errors when possible, but does not necessarily guarantee that the output is valid.

    However, the general philosophy of many operations in GEOS is that inputs should be geometrically valid - so if you are running into errors like the above, first run pygeos.is_valid() to identify those followed by pygeos.make_valid() on the geometries that need it.

    1 reply
    Martin Nguyen
    @Martin20494
    Hi everyone, I have a question about to_file() function. My geopandas dataframe have three columns: id, value, geometry (polygons). The value column is different for each polygon. However, when I tried to_file() function (saved as shp file) and opened it using QGIS to check the result, all the pixels had the same colors, it didn't show the value features (but when I use plot() from matplotlib specifying column="value", it did show). Do you know how to solve this issue?
    Martin Fleischmann
    @martinfleis
    In QGIS, you need to specify layer style to see the values on the map. By default, it uses a single colour.
    Martin Nguyen
    @Martin20494
    Hi Fleischmann, thank you very much for your reply. Could you please give me some details about specifying layer style? I have tried Open Attribute Table --> Select features using expression --> Fields and Values --> depth, but this way only gave me one polygon with one color. I plan to visualise the polygons in shapefile with different colors according to the values in value columns. (Sorry I'm new to these things)
    (depth here is the value column)
    Martin Fleischmann
    @martinfleis
    Martin Nguyen
    @Martin20494
    Hi Fleischmann, thank you so so much. I finally made it the instruction from the link you sent :)) Just one more question. I am also looking for a function in geopandas that help me to yield the value of any coordinates in the polygons. Is there any function or solution that could do that? Specifically, i have the coordinates (let's say) x = 1769728, y = 5473053, and put that into the function yeild_value_function(shapefile, x, y) then I will get the value of that xy coordinates.
    Martin Fleischmann
    @martinfleis
    sjoin will probably do what you want.
    Martin Nguyen
    @Martin20494
    Do you mean some thing like a point(x, y) <sjoin> geodataframe(id, value, geometry-polygons)? But as I understand, sjoin is for two dataframes (which is different in this case a point and a dataframe). Also, the point is given might be within one of the polygons (not exactly the coordinates of polygons).
    msahajar
    @msahajar
    Hey everyone, I am trying to use the geopandas.read_file but I keep running into an AttributeError: module 'geopandas' has no attribut ' read_file'. I installed geopandas with conda forge. I looked up work arounds but didn't find any. Any suggestions please?
    Joris Van den Bossche
    @jorisvandenbossche
    Can you show the full error traceback? (also, make sure you don't have a geopandas.py file in the working directory)
    Casper van der Wel
    @caspervdw
    Hi all, I just released pygeos 0.11.1. We now ship GEOS 3.10.0 instead of 3.9.1. A detailed changelog is over here: https://pygeos.readthedocs.io/en/stable/changelog.html#version-0-11-1-2021-10-30
    Philip Nelson
    @philipmnelson
    Hey all! Is it possible to add links to the highlighted matplotlib.pyplot methods? It might be worth it for readability's sake. I was struggling with an issue for a whie until I had someone point that I could pass kwargs for these specific methods into legend_kwargs. Just a thought but figured it wasn't worth filing an issue for. https://geopandas.org/docs/reference/api/geopandas.GeoDataFrame.plot.html#:~:text=matplotlib.pyplot.legend()%20or%20matplotlib.pyplot.colorbar()
    Martin Fleischmann
    @martinfleis
    Hey @philipmnelson. Yes, we can do it via intersphinx mapping. Can you file it as an issue / make a PR? Otherwise I am sure we'll forget.
    Philip Nelson
    @philipmnelson
    @martinfleis I'll file an issue! :)
    Philip Nelson
    @philipmnelson
    Joris Van den Bossche
    @jorisvandenbossche
    FYI geopandas.org now points to readthedocs, and no longer to the github pages!
    1 reply
    (which means we can also remove the gh-pages branch / setting I suppose)
    Martin Fleischmann
    @martinfleis
    Do we have the full control of the domain now?
    Joris Van den Bossche
    @jorisvandenbossche
    No, Kelsey did the actual change to update the CNAME / ALIAS etc to have it setup with readthedocs (but still going to ask him if he would prefer transferring the domain to eg NumFOCUS)
    Martin Fleischmann
    @martinfleis
    I think it'd be better. We discussed setting up the blog, which would need another change
    Martin Fleischmann
    @martinfleis
    Anyone knows how to make conda-forge to build a linux-aarch64 version of the package (e.g. pygeos)?
    I am trying to build geospatial Docker container on M1 Mac and it is a bit cumbersome at the moment
    Joris Van den Bossche
    @jorisvandenbossche
    There was a PR to add osx-arm64 (https://github.com/conda-forge/pygeos-feedstock/pull/37/files) that was done automatically by a bot
    For linux-aarch64, I don't know if there are also bots for that. But looking at that PR, it might be possible to add linux-aarch64 to conda-forge.yml, and then let it rerender
    It has a linux_aarch64: linux_64 entry
    I think adding that to pygeos should do the trick
    Joris Van den Bossche
    @jorisvandenbossche
    And I just wanted to mention that you could maybe also add the package to the migration file (https://conda-forge.org/docs/maintainer/knowledge_base.html#apple-silicon-builds), but I see you already found that :) (https://github.com/conda-forge/conda-forge-pinning-feedstock/pull/2161)
    Martin Fleischmann
    @martinfleis
    There's a bot for linux-aarch64 as well, it just is not documented anywhere. You just need to list your packages in conda-forge-pinning in arch_rebuild.txt.
    Martin Nguyen
    @Martin20494
    Hi there, do you have any ideas about how to speed up the process of geopandas writing to file (shape file)? I have a GeoDataFrame with the shape (487204, 3). Columns are 'id', 'value', 'geometry'. 'Geometry' column contains polygons. These polygons represents pixels size 10 meters. I am using geopandas version 0.10.2. At the moment, to write that into shape file, it requires about 13 mins. I look for any way to be able to speed it up even just 5 mins, but ideally about 1 mins. Please let me know if you need more information.
    Martin Fleischmann
    @martinfleis

    Hi @Martin20494, I'd recommend checking pyogrio library. https://github.com/geopandas/pyogrio It is still in development but it can give you speedups you are looking for.

    >>> from pyogrio import write_dataframe
    >>> write_dataframe(df, '/tmp/test.shp')

    I recommend installing it from conda-forge via conda install pyogrio -c conda-forge, there are no wheels on PyPI yet.

    Martin Nguyen
    @Martin20494
    @martinfleis : Thank you so much for your idea, I have just tried and it works =))
    akashlp27
    @akashlp27
    Hi all, do you have any ideas about finding the percentage of overlap in a single shapefile say for example one feature overlaps with other feature in the same shapefile. I tried but could'nt find any solutions online, i tried with Qgis too, like finding the sum of the width of the 2 features and dividing by the distance between the centroid this didn't help. Please let me know if you need more info
    Martin Fleischmann
    @martinfleis
    The link for today's call, starting in 2 minutes: https://us06web.zoom.us/j/88360697466?pwd=ZXlxSXd6WWI2bEoxS2ZzbjZSa3d5Zz09
    jadebel
    @jadebel
    Hi - I'm working on geopandas/geopandas#967 with @Verdarias, is this the place to ask for help regarding fixing issues?
    Martin Fleischmann
    @martinfleis
    @jadebel yes but it may be better to ask in the issue.
    jadebel
    @jadebel
    Thanks - will do :)