Merge pull request #11737 from ahocevar/esrijson-wkid

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

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