[mapserver-users] Mapserver Layer Filter

adams adams at terrestris.de
Fri Jan 13 02:39:29 EST 2012


Dear Håkon,

I am not quite sure about MSSQL databases, but for postgres I would
suggest creating a view on the datatable and using the view as datasource.
This gives you higher flexibility, although a WHERE-clause in the
datarequest in the mapfile is possible at all (see this postgis examples
here: http://mapserver.org/input/vector/postgis.html).

You get the highest flexibility, if you use a kind of variable
substitution as filter by passing a vendor specific parameter to the
map-request. (http://mapserver.org/mapfile/variable_sub.html), use this
in combination with the "WHERE" clause from above.
In order to make sure, that unauthorized users could not access the
"forbidden" attributes, you have to use something like a proxy between
the requesting client and the mapserver, which adds this parameter for
you and in the same state deletes all other possibly added parameters
and also checks for authorization.


Regards, Till



On 13.01.2012 08:24, Eichner, Andreas - SID-NLKM wrote:
> 
> You might try OGR Virtual Data Driver: http://www.gdal.org/ogr/drv_vrt.html. 
> 
>> -----Ursprüngliche Nachricht-----
>> Von: mapserver-users-bounces at lists.osgeo.org 
>> [mailto:mapserver-users-bounces at lists.osgeo.org] Im Auftrag 
>> von Hawk AA
>> Gesendet: Donnerstag, 12. Januar 2012 17:24
>> An: mapserver-users at lists.osgeo.org
>> Betreff: [mapserver-users] Mapserver Layer Filter
>>
>> Hi there, Mailing List,
>>
>>  
>>
>> We have a customer that wants their maps to be published 
>> online, but some of the features is confidential and should 
>> not be displayed.
>>
>>  
>>
>> We have added following to the layer definition:
>>
>> FILTER ('[type]' != "GRØFT ")
>>
>> It works, the features with type GRØFT are not showed in the map.
>>
>>  
>>
>> However, we have a window that let the user browse the data, 
>> and it will be possible to access the features of type GRØFT. 
>> When you press "show in map", the JavaScript clients triggers 
>> a WFS request with a filter asking for elements with the 
>> current ID. By doing this, WFS omits the LAYER FILTER 
>> definition, so the element can be showed in the map, even if 
>> it is of type GRØFT. I need a way to make sure the WFS can't 
>> deliver any data of type GRØFT.
>>
>>  
>>
>> I've seen three possible solutions:
>>
>> 1.       We have a service that automatically converts 
>> uploaded MapInfo *.TAB-files to SHP. If I am correct, I could 
>> use the "-where"-argument on the ogr2ogr to filter data and 
>> only get features which does not have type GRØFT. I hope I do 
>> not have to do this, since debugging and developing a windows 
>> service is quite tricky.
>>
>> 2.       Add additional filter values to the WFS query. I 
>> could also define the types not to show in the JavaScript, 
>> and let the application automatically add 
>> <PropertyIsNotEqualTo>-tags to the AJAX query. This would be 
>> less secure, and I need to define types not to show at two places.
>>
>> 3.       The best solution in my eyes is to let the magic 
>> happen in the MAP-file, and that is mostly why I am posting 
>> here. Is there a way to add a query to the Layer Data 
>> definition, like you do if you are querying a MSSQL database? 
>> I can imagine a syntax like this:
>> CONNECTIONTYPE OGR
>> CONNECTION "TM_Nett/TM_Points"
>> DATA "SELECT * FROM tm_points WHERE type!='GRØFT'"
>> It does not seem to work.
>>
>>  
>>
>> Any suggestions, especially regarding the third solution?
>>
>>  
>>
>> Best regards,
>>
>> Håkon Åmdal
>>
>>  
>>
>>  
>>
>>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 


--> GO Mobile - make WebGIS on Smartphones <--
! Achtung - terrestris hat eine neue Adresse !

---------------------------------------------------------
terrestris GmbH & Co. KG
Puetzchens Chaussee 56
53227 Bonn
Germany

Till Adams
Geschaeftsfuehrung

Tel: 		+49 (0)228 / 962 899-52
Mobile:	+49 (0)151 / 25394429
Fax: 		+49 (0)228 / 962 899-57

adams at terrestris.de
http://www.terrestris.de
Amtsgericht Bonn, HRA 6835
---------------------------------------------------------

Komplementaerin:

terrestris Verwaltungs GmbH

vertreten durch:
Hinrich Paulsen, Till Adams


More information about the mapserver-users mailing list