Skip to content

Commit

Permalink
Merge pull request #140 from stuartwoodman/AUS-4218-Geo-Provinces-Broken
Browse files Browse the repository at this point in the history
AUS-4218 Geo-Provinces Polygons Broken
  • Loading branch information
vjf authored Sep 16, 2024
2 parents b8e1877 + e09d32f commit e2da56b
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,23 @@ export class CsClipboardService {
}
return lngLatList.join(' ');
}

/**
* Method for extract a polygon coords string from geometry.
* @param geometry string
* @returns the string of a polygon string.
*/
public getCoordinates(geometry: string): string {
const tag = '<gml:coordinates xmlns:gml=\"http://www.opengis.net/gml\" decimal=\".\" cs=\",\" ts=\" \">';
const coordsString = geometry.substring(
geometry.indexOf(tag) + tag.length,
geometry.indexOf('</gml:coordinates>')
);
return coordsString;
let coordString = '';
const gmlCoordsTagPos = geometry.indexOf('<gml:coordinates');
if (gmlCoordsTagPos !== -1) {
const closingGmlCoordsTagPos = geometry.indexOf('>', gmlCoordsTagPos);
coordString = geometry.substring(closingGmlCoordsTagPos + 1, geometry.indexOf('</gml:coordinates>'));
}
return coordString;
}


/**
* swap coordinates for geometry.
* @param geometry string
Expand All @@ -103,6 +107,7 @@ export class CsClipboardService {
const swapedGeometry = this.getGeometry(swappedCoords);
return swapedGeometry;
}

/**
* Method for construct a polygon geometry.
* @param coords string
Expand Down Expand Up @@ -191,8 +196,8 @@ export class CsClipboardService {
};
reader.readAsText(file);
}

}

/**
* Load a polygon on map from ROI
*
Expand All @@ -216,6 +221,7 @@ export class CsClipboardService {
this.polygonsBS.next(this.polygonBBox);
return;
}

/**
* Add a polygon to the clipboard, usually from a layer
* @param newPolygon polygon object
Expand Down

0 comments on commit e2da56b

Please sign in to comment.