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
Implement msPostGISLayerGetExtent (#3585) #4825
Conversation
Implement msPostGISLayerGetExtent (#3585)
#3585 gives some insight as to why this was not implemented, c.f @pramsey:
Unless I am mistaken I don't see any code in this PR to tackle this issue, and would expect that this feature be disabled by default unless voted forward by the PSC. |
This is the reason we set the extents via metadata for Oracle and PostGIS for all of our datasets. Its just too expensive to calculate on the fly. |
@tbonfort Not sure what you mean. If the user sets the extent of the layer manually (probably in the mapfile) that overrides the postgis extent calculation, see msLayerGetExtent in maplayer.c. But in most cases no one would like to set the extent manually if it can be returned by postgis as well. I don't see any comments about the performance issues with ST_Extent it may probably use statistics to make it fast enough. |
@szekerest : Paul explicitely chose to disable that functionality as it may cause a denial of service (st_extent is not optimized and does not use statistics). Your patch goes against his intention and therefore should imho at least be voted on by the PSC before being applied. If the PSC were to approve that this functionality be on by default, then the migration guide should also prominently expose the fact that mapfiles need to be updated in order to avoid this denial of service. |
@tbonfort I don't think that such driver specific issues require an RFC to be issued and I also don't see where 'Paul explicitely chose to disable that functionality as it may cause a denial of service'. Do we have any comments in the mapserver documentation about that this functionality will never be implemented? On the contrary I see Paul has started to implement that, but he had problems with the subqueries (which anyway has been addressed) It must also be mentioned that this functionality has been added to master and not to any of the stable branches. In this regard everyone should not expect that mapserver will behave exactly the same as the previous version. Services should either specify the extent manually or let the drivers to calculate that using the driver specific approach. This behaviour is already documented in the mapfile documentation, so returning invalid extents by a service should be considered as a mistake: EXTENT [minx] [miny] [maxx] [maxy] Anyway I'll open up a discussion about this topic, but I won't agree to force PostgisLayerGetExtent never be implemented is a reasonable route (in contrast to almost all of the other drivers) to avoid performance issues. |
@szekerest I'm not opposed to this as there clearly is a need for this feature. Although not written in the documentation, to me
is quite clear to express that the feature was intentionally left out, and therefore would need to be brought up for discussion. |
@tbonfort This feature was implemented upon user request (and it has been confirmed to work in this way) so there's no doubt it is needed. The citation you mentioned doesn't mean we should never implement msPostgisLayerGetExtent just that the "least worse" solution is to set the extent manually, which shall continue to be an option here as well. |
My word is certainly not god, and other PSC members (@dmorrisette) have asked in the past that I implement the naive extent calculation. I think if @szekerest is willing to accept the implications of the change, and deal with support questions on it, then the patch is OK. My opinion, however, remains the same: when it fails, it'll fail ugly and non-obvious and unexpected. The current behaviour fails fast and more obviously, which is preferable. |
Can someone provide a little background on why and where layer extents are used? I have never used them and in fact never noticed that there was an extents at the layer level. I have always set the extents at the map level, so I guess by default the layers inherit that. I presume that the layer extents are checked to see if the whole layer can be rejected if the image extents does not overlap with the layer extents. Is this correct? Assuming that it is correct, are we changing this behavior? ie: the layer inheriting from the map extents? (assuming that it did). I would not want to take a performance penalty or not having this and would not want to have to change all my mapfiles to add the extents to all the layers. |
In a GIS-style map, you might have 'zoom to layer' functionality. Apps that only consume a few layers might use just the combined extents to drive zoom-to-extent behaviour. |
Ahh, that makes sense, so how is this queried from the application? Is there a CGI function? or OWS request that trigger this? I guess where my thought is going is that if it is a specific trigger mechanism then it is more controlled behavior than if it is some hidden trigger or something that happens all the time. I also like Even's suggestion of |
Seems we keep 2 different pathes of the discussion with similar comments, I'd suggest to replicate all the comments to the mailing list too. |
@pedros007 I wonder how your layer definition is looking like in this case |
My data statement for the layer is maybe a bit verbose? My schema has a The error goes away if I add The quadkeys referenced in the query are Bing Maps tiling scheme. Partitions are level 9, tiles are level 12.
Edit: Also, I should mention that with mapserver-6.4, I used
Mapserver-7 seems to have deprecated the FILTER syntax for SQL queries in preference for adding to the WHERE clause. So I updated my query like so:
|
It seems that the table name is not correctly identified with this complex expression (the innermost "from 0" is considered to define the table name). I'll see how that could be work arounded. |
Thanks, @szekerest . I opened #5365 to track this. |
No description provided.