Write the correct SRS code in EsriJSON

This commit is contained in:
Andreas Hocevar
2020-11-12 09:28:28 +01:00
parent 9c5e61ffb0
commit 619fd4965b
2 changed files with 31 additions and 10 deletions
+5 -7
View File
@@ -207,16 +207,14 @@ class EsriJSON extends JSONFeature {
const geometry = feature.getGeometry();
if (geometry) {
object['geometry'] = writeGeometry(geometry, opt_options);
if (opt_options && opt_options.featureProjection) {
const projection =
opt_options &&
(opt_options.dataProjection || opt_options.featureProjection);
if (projection) {
object['geometry'][
'spatialReference'
] = /** @type {EsriJSONSpatialReferenceWkid} */ ({
wkid: Number(
getProjection(opt_options.featureProjection)
.getCode()
.split(':')
.pop()
),
wkid: Number(getProjection(projection).getCode().split(':').pop()),
});
}
delete properties[feature.getGeometryName()];