Merge pull request #11737 from ahocevar/esrijson-wkid

Write the correct SRS code in EsriJSON
This commit is contained in:
Andreas Hocevar authored and GitHub committed 2020-11-19 13:50:56 +01:00
commit 698fca2d56
3 files changed
+52 -21

No files matched your search

+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()];