-
-
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
Add crs to GeoJSON when not CRS84 #58173
Comments
It has been done on WMS GetFeatureInfo and WFS #56600 and is already available in QGIS 3.38 Do you confirm that it fulfill your needs? |
Using 3.38.0 Export with settings: Coordinate Precision:10 Gives this: There is no CRS attribute or something similar. |
@jkr-wrk I do not replicate that when exporting a layer already in EPSG:28992 (or overriding its CRS in the dialog) as GeoJSON using the Export / Save Features As dialog box. The generated GeoJSON contains |
This is the file I opened and saved as GeoJSON again. I also tried with this service (using 3.39.0 just now): And coordinates are in 28992 but no crs attribute is available. |
I somehow reproduce the issue, but in a different way. The CRS does get exported, but the geometry not. {
"type": "FeatureCollection",
"name": "foo",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::28992" } },
"features": [
{ "type": "Feature", "properties": { "fid": 8, "statcode": "PV27", "statnaam": "Noord-Holland", "jrstatcode": "2022PV27", "rubriek": "provincie" }, "geometry": null }
]
} |
Strange, I can't reproduce that using 3.39.0. Would like to test 3.34.9 or 3.38.1 but OSGeo4W fails to install these versions. Looks like Windows Defender is preventing today. |
The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale". |
Tried again today using 3.38.2: { Steps to reproduce... Instal PDOK Services Plugin |
@jkr-wrk, using QGIS 3.38.2 (OSGeo4W) with GDAL/OGR 3.9.2 on Windows 10
{
"type": "FeatureCollection",
"name": "4326-28992",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::28992" } },
"xy_coordinate_resolution": 1e-10,
"features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 167453.3256934369, 497815.226271763 ] } }
]
}
{
"type": "FeatureCollection",
"name": "28992",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::28992" } },
"xy_coordinate_resolution": 1e-10,
"features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 167453.3256934369, 497815.226271763 ] } }
]
} So, it seems to me the crs attribute is correctly present in the exported GeoJSON layers. |
@jkr-wrk , afterwards I've imported the provided test_json_RFC7946_NO.json, assigned EPSG:28992 as the layer's CRS, and exported such layer following the same procedure and using the same parameters (leaving the CRS set to EPSG:28992): {
"type": "FeatureCollection",
"name": "test_json_RFC7946_NO_28992",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::28992" } },
"xy_coordinate_resolution": 1e-10,
"features": [
{ "type": "Feature", "properties": { "fid": 8, "statcode": "PV27", "statnaam": "Noord-Holland", "jrstatcode": "2022PV27", "rubriek": "provincie" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 150817.7896144802, 477979.2072202922 ], [ 150870.1662389686, 477927.4095703705 ], [ 150089.3342324059, 478192.6626739331 ], [ 150077.1968909417, 478439.1956211975 ], [ 150672.9224872852, 478433.978409293 ], [ 150977.1665158421, 478163.0254149203 ], [ 150817.7896144802, 477979.2072202922 ] ] ], [ [ [ 131307.2914809157, 482947.1495827798 ], [ 131146.2443887191, 482908.4246546297 ], [ 131104.3021696125, 483250.8019863805 ], [ 131247.3499429776, 483245.0803827818 ], [ 131429.9798880598, 483096.9133843749 ], [ 131307.2914809157, 482947.1495827798 ] ] ], [ [ [ 134232.8620112413, 484164.4973444095 ] ... Even this time it seems to me the crs attribute is correctly present in the exported GeoJSON layer. |
The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale". |
While we hate to see this happen, this issue has been automatically closed because it has not had any activity in the last 42 days despite being marked as feedback. If this issue should be reconsidered, please follow the guidelines in the previous comment and reopen this issue. |
Feature description
Wouldn't it be good practice to add the crs attribute to a GeoJSON when it is not the default crs?
For example:
{
"type": "FeatureCollection",
"name": "myname",
"crs" : {
"type" : "name",
"properties" : {
"name" : "EPSG:28992"
}
},
"xy_coordinate_resolution": 1e-10,
"features": []
}
Additional context
This is how other software implements using custom CRS with GeoJson.
The text was updated successfully, but these errors were encountered: