-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export to KML generates invalid file #60207
Comments
@Yogurt4, thanks for reporting. It looks like the CRS defined for the provided ESRI Shapefile layer is correctly recognised/supported neither by QGIS nor by the GDAL/OGR library (maybe also the PROJ library), thus the transformation to the EPSG:4326 CRS fails. |
@agiudiceandrea yes, you can see that in the logs: |
As a note, this is the official datum used in the whole country. I know it's a mathematically difficult projection, but QGIS itself manages fine to display it. You can put OpenStreetMap tiles behind it to check. |
It doesn't seems the case in my system (QGIS 3.40.2 OSGeo4W / Windows 10):
projinfo shows some issue in the layer's CRS definition stored in the *.prj ESRI Shapefile sidecar file:
To workaround the issue, you need to manually assign (Layer Properties -> Source -> Assigned Coordinate Reference System) the CRS "EPSG:23700" to the layer. You can also use the "Define Shapefile projection" processing algorithm to permanently set the CRS "EPSG:23700" to the ESRI Shapefile layer. This way, the exported KML layer is correctly generated. |
The exporting issue with such layer also occurs for any other output layer format, when a reprojection is needed (if a different output CRS is set), and also using the "Vector general -> Reproject layer" processing algorithm. Even ogr2ogr (from GDAL/OGR 3.9.3) generates not correctly transformed KML file (and any other file format) layer and prints various error messages:
|
The difference might be due to that I have conversions from EOV (to WGS-84 and to Web Mercator) added. Then it's just lacking some user feedback on failure as @elpaso wrote. |
@rouault I am looking at the issue, it seems to me that OGR_G_ExportToKML should return NULL when such an error occoured, if that's the case I can fix this upstream instead of a fragile "let's check if OGR has error" from QGIS. |
@elpaso, the exporting issue with such layer also occurs for any other output layer format, not only KML. |
yes that would be the right thing to do here |
@Yogurt4 Do you know which software has generated this shapefile ? The use of "Oblique_Mercator" in the .prj file is incorrect, or at the very least unttypical, it should be instead "Hotine_Oblique_Mercator_Azimuth_Center" |
I'll try to get information on this. It was exported by a government organisation. (The Shapefile has other issues, like inconsistency between the points, the element bounding boxes and the file bounding box.) |
What is the bug or the crash?
The export progress goes smoothly without any warnings and finishes successfully but the generated file has all
<coordinates>0.0,inf 0.0,inf 0.0,inf 0.0,inf 0.0,inf</coordinates>
in it.
Steps to reproduce the issue
0.0,inf
.A funny thing: If you leave the "Add exported file to the map" (or whatever it's in English) checkbox checked, a new layer is added with seemingly proper contents. However, if you try to add the just-saved KML, the map remains empty (obviously).
Versions
Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: