Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mask layer fails when request srs is not the same as database srs #5115

Closed
AsgerPetersen opened this issue Jul 6, 2015 · 3 comments
Closed

Comments

@AsgerPetersen
Copy link

It seems that mask layers don't transform request bbox to database srs when requesting masking polygons from backend.

Performing a WMS request in epsg:4326 against a mask layer defined in epsg:25832 (utm32 etrs89) will send the following SQL to postgres

 msPostGISLayerWhichShapes query: select encode(ST_AsBinary(ST_Force2D("geom"),'NDR'),'hex') 
as geom,"uid" from (select g.uid, g.geom from public.mask_polygon g WHERE uid in (5,6)) as subquery 
where geom && ST_GeomFromText('POLYGON((10.1747920246582 
55.374061201518,10.1747920246582 55.4801852455007,10.5639135192612 
55.4801852455007,10.5639135192612 55.374061201518,10.1747920246582 
55.374061201518))',25832)

The coordinates in the bounding polygon are clearly in 4326 and not in 25832 as they are declared to be.

The mask layer definition is

LAYER
  DEBUG 5
  NAME "polygon_mask_filter"
  STATUS ON
  TYPE POLYGON
  CONNECTIONTYPE POSTGIS
  CONNECTION "host=host port=5432 dbname=PolygonMaskDB user=user password=pass"
  PROCESSING "CLOSE_CONNECTION=DEFER"
  METADATA
   "wms_enable_request" "!*"
  END
  DATA "geom from (select g.uid, g.geom from public.mask_polygon g WHERE uid in (5,6)) as subquery using unique uid using srid=25832"
  VALIDATION
    "mask_global" ".*"
    "default_mask_global" "null"
  END
  CLASS
    STYLE
      COLOR 0 0 0
      ANTIALIAS true
    END
  END
END

I am using mapserver 6.4.1.

I guess this issue is related to #5114

@tbonfort
Copy link
Member

tbonfort commented Jul 6, 2015

Can you try explicitly setting a PROJECTION block on the relevant layers and report back?

@AsgerPetersen
Copy link
Author

Cool! Adding a PROJECTION block to the mask layer seems to work around this issue (and also #5114).

My mask layer definition now looks like:

LAYER
  DEBUG 5
  PROJECTION
    "init=epsg:25832"
  END
  NAME "polygon_mask_filter"
  STATUS ON
  TYPE POLYGON
  CONNECTIONTYPE POSTGIS
  CONNECTION "host=host port=5432 dbname=PolygonMaskDB user=user password=pass"
  PROCESSING "CLOSE_CONNECTION=DEFER"
  METADATA
   "wms_enable_request" "!*"
  END
  DATA "geom from (select g.uid, g.geom from public.mask_polygon g WHERE uid in (5,6)) as subquery using unique uid using srid=25832"
  VALIDATION
    "mask_global" ".*"
    "default_mask_global" "null"
  END
  CLASS
    STYLE
      COLOR 0 0 0
      ANTIALIAS true
    END
  END
END

Thank you @tbonfort !

@tbonfort
Copy link
Member

very probably related to #4873, should be fixed in 7.0. closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants