1
result_polys = sol.vector.polygon.georegister_px_df(mask2poly, 
                                               affine_obj=tile_tfm, 
                                               crs= 'epsg:4326')

print(result_polys.crs)

epsg:EPSG:4326

result_polys.to_file('result_polys.geojson', driver='GeoJSON')

CRSError: Invalid input to create CRS: epsg:EPSG:4326

4

I'm one of the maintainers for the solaris project. I tried to reproduce your error in my environment but could not.

If you open an issue in the solaris github repo with the full traceback, and your python/solaris/pyproj/fiona versions, then we would be happy to try to figure out what's going on.

2

According to Solaris Documentation, You have to pass an integer value for crs.

crs (int) – The coordinate reference system for the output GeoDataFrame as an EPSG code integer.

Try to use 4326 instead of 'epsg:4326'.

result_polys = sol.vector.polygon.georegister_px_df(mask2poly, 
                                                    affine_obj=tile_tfm, 
                                                    crs=4326) ####

But according to source code, it accepts the following types. You can try them.

  1. dict: crs = {'init': 'epsg:4326'}
  2. epsg string: crs = 'epsg:4326'
  3. PROJ4 string: crs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
  4. wkt string: crs = 'GEOGCS["WGS 84",DATUM["WGS_1984".........]]'
  5. CRS object:

    from pyproj import CRS        
    crs = CRS("epsg:4326")
    

Then, use crs :

result_polys = sol.vector.polygon.georegister_px_df(mask2poly, 
                                                    affine_obj=tile_tfm, 
                                                    crs=crs) ####
  • Sahbaz thanks for your inputs. I tried using 4326 instead of 'epsg:4326'. It displays the same error. – Ishaan Dec 31 '19 at 8:30
  • Which version of pyproj do you use? You can learn using import pyproj; print(pyproj.__version__) – Kadir Şahbaz Dec 31 '19 at 9:27
  • It's 2.4.2.post1 – Ishaan Dec 31 '19 at 9:31
  • I've updated the answer. I guess the problem is about fiona, and I guess, but I'm not so sure, dict version solves your problem. – Kadir Şahbaz Dec 31 '19 at 9:58
  • I tried all these combinations earlier as well. Even I think the problem is with fiona – Ishaan Dec 31 '19 at 10:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.