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



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

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


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.

  • 1
    This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review – J. Monticolo Jan 1 '20 at 16:29
  • 2
    @J.Monticolo, can you clarify how I'm supposed to give feedback as the maintainer of the project being asked about, if I don't have enough rep to comment in GIS stackexchange yet, if the answer isn't appropriate? – nweir Jan 1 '20 at 17:56
  • 1
    I give you an upvote for comments privilege (50) ! But this kind of answer, for me, is more for comments than a proper answer. – J. Monticolo Jan 2 '20 at 10:30

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, 
                                                    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, 
                                                    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.