Date   

Re: convert to bounding box for object detection #976

René Buffat
 

You can find information about how to find the bounding box of a dataset in Fiona's documentation: https://fiona.readthedocs.io/en/latest/manual.html#format-drivers-crs-bounds-and-schema
The bounding box of individual features can be calculated with shapely: https://shapely.readthedocs.io/en/latest/manual.html


convert to bounding box for object detection #976

ronaldocr9803@...
 

I have 4 raster images and 1 shpfile contains polygons for these images and i want to convert shpfile to bounding box in object detection . Because the size of raster image is so big, i have to split into tiles, but i don have label corresponding in this tile  .how can i get bounding box corresponding of each tiles by shpfile


Re: [dev] Performance regression: fiona.transform much slower since GDAL 3

stefan.brand@...
 

Hi Sean,

thanks for putting my mail in the right place!

The sqlite version should not be a problem as we have sqlite 3.33
installed.

It seems that the performance issue indeed was with initializing the
transformer over and over again. I get much better results with
pyproj: https://gis.stackexchange.com/a/376247/122597

I will test this fix in our real-life code and get back to you if I run
into troubles.

Thank you!
Best, Stefan

On Fri, 2020-10-09 at 12:24 -0600, Sean Gillies wrote:
Hi Stefan,

I'm cross-posting this over to main@fiona.groups.io. The dev list is
for project planning and design discussions.

Is it possible you are running into the issue with older sqlite
described in https://github.com/OSGeo/PROJ/issues/1718?

On Fri, Oct 9, 2020 at 4:53 AM <stefan.brand@eox.at> wrote:
Hello everyone,


I kindly request your comments/answers to this gis.SE question,
where I
have detailed my issue:
https://gis.stackexchange.com/q/376211/122597

If you do not have an account there, but still know an answer,
please
contact me directly via e-mail.

Thank you for your attention!


Best, Stefan







Re: [dev] Performance regression: fiona.transform much slower since GDAL 3

Sean Gillies
 

Hi Stefan,

I'm cross-posting this over to main@fiona.groups.io. The dev list is for project planning and design discussions.

Is it possible you are running into the issue with older sqlite described in https://github.com/OSGeo/PROJ/issues/1718?

On Fri, Oct 9, 2020 at 4:53 AM <stefan.brand@...> wrote:
Hello everyone,


I kindly request your comments/answers to this gis.SE question, where I
have detailed my issue: https://gis.stackexchange.com/q/376211/122597

If you do not have an account there, but still know an answer, please
contact me directly via e-mail.

Thank you for your attention!


Best, Stefan









--
Sean Gillies


WinError87 while running .EXE file

timnazarovya@...
 

Hello everyone! Maybe it is an offtop but I am a bit puzzled.. Just generated exe file for my GUI python program for working with some geospatial data and use folium,geopandas,shapely etc. However, while running an error occured(I have attached a log) . The line 9 in main.py is "import geopandas as gpd"

Geopandas imports fiona and error occurs, as I understand this error message.

What is the reason?Are there any possible ways to resolve this problem?

Thanks for response and help!


Traceback (most recent call last):
  File "main.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\timna\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\geopandas\__init__.py", line 7, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\timna\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\geopandas\io\file.py", line 7, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\timna\anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\fiona\__init__.py", line 88, in <module>
  File "contextlib.py", line 113, in __enter__
  File "site-packages\fiona\_loading.py", line 54, in add_gdal_dll_directories
  File "os.py", line 1109, in add_dll_directory
OSError: [WinError 87]  The parameter is incorrect: ''
[15176] Failed to execute script main


Re: Using Fiona to consume ESRI FeatureServer service

Chander Ganesan
 

Thanks! That worked for me - sorry, I didn't realize the difference between open options and config options.

I'm basically in the process of using multicorn to provide a FDW to access ArcGIS FeatureServer layers via postgresql.  I'm also finding an issue with SSL, which I cannot figure out - I suspect that it's tied somehow to the environment that the script runs in under multicorn (because from the command line the attempt to open the layer works just fine.) However, if you have some other insight I'd love to hear it.

If I can't get past this I'll go another route...  Probably pgsql-ogr-fdw (I need to munge some of the data coming back from the service to allow for time-related queries/read - and FeatureServer represents times in epoch milliseconds, hence me not using the pgsql one out of the box.)

This is after an: import fiona; fiona.open('https://services.arcgis.com/...&f=json') 

TIA! :-) 

Traceback (most recent call last):
        File "fiona/_shim.pyx", line 74, in fiona._shim.gdal_open_vector
        File "fiona/_err.pyx", line 270, in fiona._err.exc_wrap_pointer
fiona._err.CPLE_HttpResponseError: CURL error: failed setting cipher list: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH

On Thu, Jul 30, 2020 at 10:17 PM Sean Gillies <sean.gillies@...> wrote:
Hi,

I'm not very familiar with this category of data, but I see in https://gdal.org/drivers/vector/esrijson.html that `FEATURE_SERVER_PAGING` is an *open* option, not a configuration option. That means you must pass it to fiona.open() like

with fiona.open('https://services.arcgis.com/...&f=json', FEATURE_SERVER_PAGING="YES") as collection:
    features = list(collection)

I hope this helps,

On Thu, Jul 30, 2020 at 11:41 AM Chander Ganesan <chander.ganesan@...> wrote:
FYI, I've also tried to use fiona.Env(FEATURE_SERVER_PAGING='true') as a context processor - that doesn't work either.



--
Sean Gillies


Re: Using Fiona to consume ESRI FeatureServer service

Sean Gillies
 

Hi,

I'm not very familiar with this category of data, but I see in https://gdal.org/drivers/vector/esrijson.html that `FEATURE_SERVER_PAGING` is an *open* option, not a configuration option. That means you must pass it to fiona.open() like

with fiona.open('https://services.arcgis.com/...&f=json', FEATURE_SERVER_PAGING="YES") as collection:
    features = list(collection)

I hope this helps,

On Thu, Jul 30, 2020 at 11:41 AM Chander Ganesan <chander.ganesan@...> wrote:
FYI, I've also tried to use fiona.Env(FEATURE_SERVER_PAGING='true') as a context processor - that doesn't work either.



--
Sean Gillies


Re: Using Fiona to consume ESRI FeatureServer service

Chander Ganesan
 

FYI, I've also tried to use fiona.Env(FEATURE_SERVER_PAGING='true') as a context processor - that doesn't work either.


Using Fiona to consume ESRI FeatureServer service

Chander Ganesan
 

Hello,

I'm attempting to use fiona to consume an ESRI FeatureServer service - I've pased an example call below..  The issue is that OGR's documentation indicates that so long as I omit the resultOffset parameter for the service, it will handle paging for me.  Case in point - OGRInfo returns the proper, expected count of 2000+ records.

However, when I use Fiona (or, in my case geopandas, which uses Fiona) I find that the paging doesn't happen - I get 1000 records and that's it.

Is there an option/argument to get fiona to handle paging of results with the service, as OGR does?

Thanks! 


Re: fiona.transform.transform - different behavior based on GDAL version

calebrob6@...
 

Thanks! For completeness, I just opened it here https://github.com/Toblerity/Fiona/issues/919.

Best,
Caleb


Re: fiona.transform.transform - different behavior based on GDAL version

Alan Snow
 

I am betting it has to do with axis order changes with PROJ 6+ and GDAL 3+:
You can see a similar issue raised for pyproj here: https://github.com/pyproj4/pyproj/issues/538


Re: fiona.transform.transform - different behavior based on GDAL version

Joshua Arnott
 

Hi Caleb,

I can reproduce your issue with the master branch on Travis by adding a test based on the code you provided.


Please can you raise an issue on GitHub for this? Include your examples. https://github.com/Toblerity/Fiona/issues

There are a few places this problem could be coming from as it involves the interaction with Fiona, GDAL and PROJ.

Josh


On Tue, 14 Jul 2020 at 20:32, <calebrob6@...> wrote:
Hi all,

I'm observing different behavior from fiona.transform.transform based on the underlying gdal version. 

Steps to reproduce
```
conda create --name test python gdal fiona # this installs gdal 3.0.2 and fiona 1.8.13.post1
conda activate test
python
>>> import fiona.transform
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [-75.71], [38.06])
([4236819.819591993], [-13244913.18166699])
```

If I switch the lat/lon position then I get the correct result (http://epsg.io/transform#s_srs=4326&t_srs=3857&x=-75.7169053&y=38.0624956):
```
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [38.06], [-75.71])
([-8427998.647958742], [4587905.271362515])
```

If I instead do the conda install with a gdal version less than 3 I get the expected result:
```
conda create --name test2 python "gdal<3" fiona # this installs gdal 2.3.3 and fiona 1.8.4
conda activate test2
python
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [-75.71], [38.06])
([-8427998.647958742], [4587905.27136252])
```

Is this known / should I open an Issue on github?

Thanks,
Caleb


fiona.transform.transform - different behavior based on GDAL version

calebrob6@...
 

Hi all,

I'm observing different behavior from fiona.transform.transform based on the underlying gdal version. 

Steps to reproduce
```
conda create --name test python gdal fiona # this installs gdal 3.0.2 and fiona 1.8.13.post1
conda activate test
python
>>> import fiona.transform
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [-75.71], [38.06])
([4236819.819591993], [-13244913.18166699])
```

If I switch the lat/lon position then I get the correct result (http://epsg.io/transform#s_srs=4326&t_srs=3857&x=-75.7169053&y=38.0624956):
```
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [38.06], [-75.71])
([-8427998.647958742], [4587905.271362515])
```

If I instead do the conda install with a gdal version less than 3 I get the expected result:
```
conda create --name test2 python "gdal<3" fiona # this installs gdal 2.3.3 and fiona 1.8.4
conda activate test2
python
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [-75.71], [38.06])
([-8427998.647958742], [4587905.27136252])
```

Is this known / should I open an Issue on github?

Thanks,
Caleb


RFC: Roadmap for Shapely 2.0

Joris Van den Bossche
 

Dear list,

This is not directly a Fiona-related message, but I assume there might be some of you that are also Shapely users. For those, I want to get across a message about a proposal for Shapely 2.0 (and if not, you can skip the rest of the message ;)).

There is a proposal for some significant changes in Shapely: "RFC 1: Roadmap for Shapely 2.0" (https://github.com/shapely/shapely-rfc/pull/1).

Background: we have been working on a new set of Python bindings to GEOS in the PyGEOS package (https://github.com/pygeos/pygeos/). The initial focus was to make it easier and more performant to work with arrays of geometries (where Shapely is now focused on scalar geometries). See https://caspervdw.github.io/Introducing-Pygeos/ for some more details. While this separate package made it easier to experiment (and which we are still doing), on the long term, it's not ideal to have two incompatible GEOS wrappers in the Python ecosystem. Therefore, the proposal linked above is about upstreaming this work into Shapely, along with some API changes.

Given that this are some profound changes to Shapely, feedback from Shapely users would be very much appreciated! 

Best,
Joris



Fiona 1.9 Release Date

Alan Snow
 

Is there a tentative release date for Fiona 1.9? (This question is purely out of curiosity and not out of need.)


Re: pip install succeeds, ImportError on import

gavinswanson@...
 

I went through a long process of doing that yesterday. Same result.
I also noticed while doing it that appveyor is pulling the latest dev build of gdal, rather than the latest release, but not for the libs. Is this intentional?

Link to latest dev:

https://github.com/Toblerity/Fiona/blob/71f34cfa914d4ca218c395657366042823b8969b/appveyor.yml#L77

As in here: http://www.gisinternals.com/query.html?content=filelist&file=release-1911-x64-gdal-mapserver.zip

Link to stable daily libs:

https://github.com/Toblerity/Fiona/blob/71f34cfa914d4ca218c395657366042823b8969b/appveyor.yml#L78

as in here: http://www.gisinternals.com/query.html?content=filelist&file=release-1911-x64-gdal-3-0-mapserver-7-4.zip

In the interest of getting the actual project moving I did break down and start from scratch on an Anaconda env, which ended up working for me. I was having issues initially, that's why I went down the path of pip install/build for everything.


Understood that currently pre-built binaries are the way to go... But shouldn't the goal be at least pre-built wheels?

I've got some time to kick this around a little if I can get some assistance.


Re: pip install succeeds, ImportError on import

René Buffat
 

I'm not really familiar with installing Fiona on Windows.  I could imagine that potential issues could be the wrong settings of environment variables, missing Visual C++ installations, wrong location of files or the Python 3.8 dll loading issue.  
I would recommend you to try to stay as close as to our appveyor setup as possible: https://github.com/Toblerity/Fiona/blob/master/appveyor.yml
as this is proven to work. 

As long as you don't intend to modify Fiona itself, there is no need to take the "hard" route. The easy route would be to use binary packages provided by either conda or https://www.lfd.uci.edu/~gohlke/pythonlibs/


pip install succeeds, ImportError on import

gavinswanson@...
 

Trying to work out some issues importing fiona.

Python 3.8.2
GDAL: http://download.gisinternals.com/sdk/downloads/release-1911-x64-gdal-3-0-4-mapserver-7-4-3.zip and associated libs
Everything installed via pip
Doing the `add_ddl_directory` call (already a pending PR for python 3.8) manually gets past the failure to find the module.
Now it fails to find a procedure, and I'm at a complete loss for how to hunt down the issue further.
Dependency walker run against `ogrext.cp38-win_amd64.pyd` shows issues, but I'm at a loss for how to solve them.

Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.add_dll_directory('c:\program files\gdal')
<AddedDllDirectory('c:\\program files\\gdal')>
>>> import fiona
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\gavin\covid_env\lib\site-packages\fiona\__init__.py", line 84, in <module>
    from fiona.collection import BytesCollection, Collection
  File "C:\Users\gavin\covid_env\lib\site-packages\fiona\collection.py", line 9, in <module>
    from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: DLL load failed while importing ogrext: The specified procedure could not be found.




Re: KML SimpleData

Bonzo
 

Thanks Sean, much appreciated!  (thanks for the coding correction too - I was getting deprecation errors with mine!)

Regards, Bonzo.


Re: KML SimpleData

Sean Gillies
 

Hi Bonzo,

On Wed, Feb 26, 2020 at 9:41 AM Bonzo <bteluk@...> wrote:
Hi, is it possible to to retrieve SimpleData attributes from a KML document?

I've opened a collection, and tried both KML and KMZ documents - and whilst I can see the "normal" KML attributes - I cannot see the "SimpleData" attributes listed in the feature properties...

I tried to see if I could pass an OGR environment variable... but not sure if I got this right:

with fiona.drivers(LIBKML_USE_SCHEMADATA=True):
  cll = fiona.open('/vsizip/' + fnSrc + '/doc.kml',mode='r',layer='QFESCurrentIncidents')
  f1 = cll.next()
  f1['properties'].keys()
 

I'm using:
Python 2.7.9
Fiona 1.8.13
OS: Linux/Debian 8

Regards, Bonzo.

The modern usage, for fiona 1.8.x, is

import fiona

fiona.drvsupport.supported_drivers["LIBKML"] = "raw"

with fiona.Env(LIBKML_USE_SCHEMADATA=True):
    with fiona.open("file.kmz", layer="QFESCurrentIncidents") as collection:
        first = next(collection)

However, if you're using the fiona binary wheels installed from the Python package index using pip, you're out of luck. OGR's LIBKML driver, documented at https://gdal.org/drivers/vector/libkml.html, is not a default format driver and is not included in the binary wheels. This situation might explain why you don't see the SimpleData attributes.

If that's the case, I recommend installing the latest gdal-dev package from DebianGIS (I think this is very likely to entail libkml), and then installing fiona from a non-binary distribution like `pip install -I --no-binary fiona fiona`. Or get the python-fiona Debian package https://packages.debian.org/search?searchon=names&keywords=python-fiona.

I'm sorry about the lack of a LIBKML driver, but the binary wheels would be too big if we included every possible format.

--
Sean Gillies

41 - 60 of 111