Skip to content

Commit

Permalink
read data axis to CRS axis mapping ref #13945
Browse files Browse the repository at this point in the history
Signed-off-by: m-kro <[email protected]>
  • Loading branch information
m-kro committed Oct 25, 2023
1 parent 2d59e5c commit 856361c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/polyconvert/PCLoaderArcView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ PCLoaderArcView::loadIfSet(OptionsCont& oc, PCPolyContainer& toFill, PCTypeMap&
#ifdef HAVE_GDAL
const PositionVector
PCLoaderArcView::toShape(OGRLineString* geom, const std::string& tid) {
OGRSpatialReference* srs = geom->getSpatialReference();
bool latLongOrder = srs->GetAxisMappingStrategy() == OSRAxisMappingStrategy::OAMS_AUTHORITY_COMPLIANT;
if (myWarnMissingProjection) {
int outOfRange = 0;
for (int j = 0; j < geom->getNumPoints(); j++) {
Expand All @@ -101,7 +103,15 @@ PCLoaderArcView::toShape(OGRLineString* geom, const std::string& tid) {
Position pos(geom->getX(j), geom->getY(j));
#else
for (const OGRPoint& p : *geom) {
Position pos(p.getX(), p.getY());
double x, y;
if (latLongOrder) {
x = p.getY();
y = p.getX();
} else {
x = p.getX();
y = p.getY();
}
Position pos(x, y);
#endif
if (!geoConvHelper.x2cartesian(pos)) {
WRITE_ERRORF(TL("Unable to project coordinates for polygon '%'."), tid);
Expand Down

0 comments on commit 856361c

Please sign in to comment.