Cartopy: Getting projected CRS by code (EPSG:28992) returns parsing error

Created on 20 Jan 2020  路  6Comments  路  Source: SciTools/cartopy

Description

Hi,

I tried to open a simple one-band raster file containing model data. This file is in GeoTIFF format and using a projected CRS for the Netherlands: RD_New (EPSG:28992). To import the reference system I used cartopy.crs.epsg(28892) just to create some basic maps showing the data, but the program stops raising the error below.

It seems that the given EPSG code is either not found on http://epsg.io or is incorrectly parsed, thus yielding that error. This post in Stack Overflow from February 2019 suggests that this type of import was possible, thus enabling the possibility of working with projected CRS in cartopy.

I wonder whether there is anything wrong in my configuration or there is something that might need some fixing in cartopy. I am using cartopy 0.17 on a Python 3.7 installation. You can see a minimum working code producing the error below.

Thanks for your help and for your time developing cartopy!

PS - It might be related with issue #1426

Code to reproduce

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
projection = ccrs.epsg(28992)

Traceback

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/USERNAME/miniconda3/envs/defpy37/lib/python3.7/site-packages/cartopy/crs.py", line 2540, in epsg
    return cartopy._epsg._EPSGProjection(code)
  File "/home/USERNAME/miniconda3/envs/defpy37/lib/python3.7/site-packages/cartopy/_epsg.py", line 69, in __init__
    x0, x1, y0, y1 = projection.domain_of_validity()
  File "/home/USERNAME/miniconda3/envs/defpy37/lib/python3.7/site-packages/pyepsg.py", line 205, in domain_of_validity
    gml = ET.fromstring(xml)
  File "/home/USERNAME/miniconda3/envs/defpy37/lib/python3.7/xml/etree/ElementTree.py", line 1315, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: mismatched tag: line 33, column 4


Full environment definition

Operating system

Cartopy version

cartopy 0.17.0     (conda-forge)

Most helpful comment

Hi guys, the https://github.com/maptiler/epsg.io/issues/156 was solved, how to proced to make the lib work again?

All 6 comments

I believe this is related to the still-unresolved issue: https://github.com/maptiler/epsg.io/issues/156

Hi guys, the https://github.com/maptiler/epsg.io/issues/156 was solved, how to proced to make the lib work again?

I am not really sure, since the piece of code above seems to still be not working for me, despite the fixing of https://github.com/maptiler/epsg.io/issues/156. I checked my conda list to see whether I had an installation of maptiler in my environment that I could update to the latest version, but I don't. So I am not sure how to proceed. Any idea? Thanks!

Looks like it's working again in my script! :) Had the same issue until like 30min ago.

Yes, I can confirm as well. @Irene-GM how about you?

Indeed, it is working now! Thanks to all :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

QuLogic picture QuLogic  路  6Comments

dantonacci picture dantonacci  路  3Comments

maxnoe picture maxnoe  路  5Comments

leecronce picture leecronce  路  8Comments

rutgerhofste picture rutgerhofste  路  3Comments