Re: [mapserver-users] runtime CONNECTION string partial substitution

2016-05-16 Thread Rahkonen Jukka (MML)
Hi,

I am by no means a master with regexp so I took the validation [a-z]+ from the 
mail by Giovanni and tested it with the http://www.regexr.com/ tool.

I do understand now that if I do not include anchors ^and $ then it is enough 
the find one validated character and therefore [a-z]+ accepts “wms-wfs” even 
dash is not included in regexp. But why [a-z]+ is also accepting “WMS-WFS”? 
Shouldn’t it be case sensitive?

I made some more tests and these two variants accept both all lower case and 
all upper case strings on Windows with Mapserver 7.0 from MS4W:

VALIDATION
"db" "^[A-Z]+$"
END

VALIDATION
"db" "^[a-z]+$"
END

-Jukka Rahkonen-




Lähettäjä: thomas bonfort [mailto:thomas.bonf...@gmail.com]
Lähetetty: 16. toukokuuta 2016 15:31
Vastaanottaja: Rahkonen Jukka (MML)
Kopio: MapserverList OSGEO; G. Allegri
Aihe: Re: [mapserver-users] runtime CONNECTION string partial substitution


Not sure I get it. Your regex requires a letter or a dash , and one of them is 
present, no?
On May 16, 2016 2:28 PM, "Rahkonen Jukka (MML)" 
<jukka.rahko...@maanmittauslaitos.fi<mailto:jukka.rahko...@maanmittauslaitos.fi>>
 wrote:
Hi Thomas,

I was testing with http://www.regexr.com/ and it does not agree totally:

“wms-wfs” contains a dash and the test utility requires “[a-z-]+”
WMS-WFS has capital letters and dash and test utility requires “[A-Z-]+”

-Jukka-


Lähettäjä: thomas bonfort 
[mailto:thomas.bonf...@gmail.com<mailto:thomas.bonf...@gmail.com>]
Lähetetty: 16. toukokuuta 2016 15:11
Vastaanottaja: Rahkonen Jukka (MML)
Kopio: MapserverList OSGEO; G. Allegri
Aihe: Re: [mapserver-users] runtime CONNECTION string partial substitution


On May 16, 2016 2:02 PM, "Rahkonen Jukka (MML)" 
<jukka.rahko...@maanmittauslaitos.fi<mailto:jukka.rahko...@maanmittauslaitos.fi>>
 wrote:
>
> Correction:
>
>
>
> Changing the WMS online resource does work if the mapfile is written 
> correctly. I had to add VALIDATION also into MAP->WEB
>
>
>
> WEB
>
> METADATA
>
> "wms_onlineresource" 
> "http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map=%db%;
>
> END #metadata
>
>  VALIDATION
>
>  "db" "[a-z]+"
>
> END #validation
>
> END #WEB
>
>
>
> Now I can send
> http://localhost:8060/cgi-bin/mapserv.exe?map=c:/ms4w/apps/wms-wfs.map=wms=1.3.0=getcapabilities=wms-wfs
>
>
>
> and get
>  xlink:href="http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map=wms-wfs&"/>
>
>
>
> What is interesting is that the validation rule “[a-z]+” should not accept 
> the name of my db “wms-wfs” but it does. Capital letters are accepted as well 
> “WMS-WFS”. Because I am on Windows I can even get data with WMS-WFS though 
> the name of the db is “wms-wfs.sqlite”.
>
That's because [a-z]+ means "there should be at least one alphabetic character 
in the passed expression". The " correct" regex to use would be ^[a-z]+$

Thomas
>
>
> -Jukka Rahkonen-
>
>
>
>
>
> Lähettäjä: Rahkonen Jukka (MML)
> Lähetetty: 16. toukokuuta 2016 14:24
> Vastaanottaja: 'G. Allegri'; 
> mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org>
> Aihe: Re: [mapserver-users] runtime CONNECTION string partial substitution
>
>
>
> Hi,
>
>
>
> I made a test with your VALIDATION and CONNECTION and changing  db on-the-fly 
> works. How did you test?  If you use some WMS client for testing it is good 
> to remember that variable substitution does not have an effect on the 
> GetCapabilities document so that the GetMap URL would be updated 
> automatically. Therefore WMS clients like QGIS or OpenJUMP will drop the = 
> parameter from the GetMaps if you do not tell them not to trust the 
> advertised GetMap URL.
>
>
>
> According to documentation http://mapserver.org/cgi/runsub.html  it should 
> also be possible to use variable substitution also in MAP- WEB: METADATA. I 
> tried
>
> to use
>
> "wms_onlineresource" 
> “http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map&%db%”
>
>
>
> but GetCapabilities response contains the variable %db% literally
>
>  xlink:href="http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map&%db%&"/>
>
>
>
> It seems that for getting a proper error message when = is missing or it 
> is wrong a WMS GetMap request is required. WFS GetFeature triggers the error
>
> and is easier to write by hand, for example:
>
> http://localhost:8060/cgi-bin/mapserv.exe?map=c:/ms4w/apps/wms-wfs.map=wfs=2.0.0=getfeature=states=foo
>
> sends an erro

Re: [mapserver-users] runtime CONNECTION string partial substitution

2016-05-16 Thread G. Allegri
First of all thanks Jukka. I haven't tested it yet but I'm quite sure the
problem was the online resource url.

I agree with Jukka, the original regex should accept only lowercase
alphanumeric characters and nothing else. I will do some tests...

giovanni
Il 16/mag/2016 2:30 PM, "thomas bonfort" <thomas.bonf...@gmail.com> ha
scritto:

> Not sure I get it. Your regex requires a letter or a dash , and one of
> them is present, no?
> On May 16, 2016 2:28 PM, "Rahkonen Jukka (MML)" <
> jukka.rahko...@maanmittauslaitos.fi> wrote:
>
>> Hi Thomas,
>>
>>
>>
>> I was testing with http://www.regexr.com/ and it does not agree totally:
>>
>>
>>
>> “wms-wfs” contains a dash and the test utility requires “[a-z-]+”
>>
>> WMS-WFS has capital letters and dash and test utility requires “[A-Z-]+”
>>
>>
>>
>> -Jukka-
>>
>>
>>
>>
>>
>> *Lähettäjä:* thomas bonfort [mailto:thomas.bonf...@gmail.com]
>> *Lähetetty:* 16. toukokuuta 2016 15:11
>> *Vastaanottaja:* Rahkonen Jukka (MML)
>> *Kopio:* MapserverList OSGEO; G. Allegri
>> *Aihe:* Re: [mapserver-users] runtime CONNECTION string partial
>> substitution
>>
>>
>>
>>
>> On May 16, 2016 2:02 PM, "Rahkonen Jukka (MML)" <
>> jukka.rahko...@maanmittauslaitos.fi> wrote:
>> >
>> > Correction:
>> >
>> >
>> >
>> > Changing the WMS online resource does work if the mapfile is written
>> correctly. I had to add VALIDATION also into MAP->WEB
>> >
>> >
>> >
>> > WEB
>> >
>> > METADATA
>> >
>> > "wms_onlineresource" "http://localhost:8060/cgi-bin/mapserv.exe?map=c
>> :\ms4w\apps\wms-wfs.map=%db%"
>> >
>> > END #metadata
>> >
>> >  VALIDATION
>> >
>> >  "db" "[a-z]+"
>> >
>> > END #validation
>> >
>> > END #WEB
>> >
>> >
>> >
>> > Now I can send
>> >
>> http://localhost:8060/cgi-bin/mapserv.exe?map=c:/ms4w/apps/wms-wfs.map=wms=1.3.0=getcapabilities=wms-wfs
>> >
>> >
>> >
>> > and get
>> > http://localhost:8060/cgi-bin/mapserv.exe?map=c
>> :\ms4w\apps\wms-wfs.map=wms-wfs&"/>
>> >
>> >
>> >
>> > What is interesting is that the validation rule “[a-z]+” should not
>> accept the name of my db “wms-wfs” but it does. Capital letters are
>> accepted as well “WMS-WFS”. Because I am on Windows I can even get data
>> with WMS-WFS though the name of the db is “wms-wfs.sqlite”.
>> >
>> That's because [a-z]+ means "there should be at least one alphabetic
>> character in the passed expression". The " correct" regex to use would be
>> ^[a-z]+$
>>
>> Thomas
>> >
>> >
>> > -Jukka Rahkonen-
>> >
>> >
>> >
>> >
>> >
>> > Lähettäjä: Rahkonen Jukka (MML)
>> > Lähetetty: 16. toukokuuta 2016 14:24
>> > Vastaanottaja: 'G. Allegri'; mapserver-users@lists.osgeo.org
>> > Aihe: Re: [mapserver-users] runtime CONNECTION string partial
>> substitution
>> >
>> >
>> >
>> > Hi,
>> >
>> >
>> >
>> > I made a test with your VALIDATION and CONNECTION and changing  db
>> on-the-fly works. How did you test?  If you use some WMS client for testing
>> it is good to remember that variable substitution does not have an effect
>> on the GetCapabilities document so that the GetMap URL would be updated
>> automatically. Therefore WMS clients like QGIS or OpenJUMP will drop the
>> = parameter from the GetMaps if you do not tell them not to trust the
>> advertised GetMap URL.
>> >
>> >
>> >
>> > According to documentation http://mapserver.org/cgi/runsub.html  it
>> should also be possible to use variable substitution also in MAP- WEB:
>> METADATA. I tried
>> >
>> > to use
>> >
>> > "wms_onlineresource" “http://localhost:8060/cgi-bin/mapserv.exe?map=c
>> :\ms4w\apps\wms-wfs.map&%db%”
>> >
>> >
>> >
>> > but GetCapabilities response contains the variable %db% literally
>> >
>> > http://localhost:8060/cgi-bin/mapserv.exe?map=c
>> :\ms4w\apps\wms-wfs.map&%db%&"/>
>> >
>> >
>> >
>> > It seems that for getting a proper error message when = is missing

Re: [mapserver-users] runtime CONNECTION string partial substitution

2016-05-16 Thread thomas bonfort
Not sure I get it. Your regex requires a letter or a dash , and one of them
is present, no?
On May 16, 2016 2:28 PM, "Rahkonen Jukka (MML)" <
jukka.rahko...@maanmittauslaitos.fi> wrote:

> Hi Thomas,
>
>
>
> I was testing with http://www.regexr.com/ and it does not agree totally:
>
>
>
> “wms-wfs” contains a dash and the test utility requires “[a-z-]+”
>
> WMS-WFS has capital letters and dash and test utility requires “[A-Z-]+”
>
>
>
> -Jukka-
>
>
>
>
>
> *Lähettäjä:* thomas bonfort [mailto:thomas.bonf...@gmail.com]
> *Lähetetty:* 16. toukokuuta 2016 15:11
> *Vastaanottaja:* Rahkonen Jukka (MML)
> *Kopio:* MapserverList OSGEO; G. Allegri
> *Aihe:* Re: [mapserver-users] runtime CONNECTION string partial
> substitution
>
>
>
>
> On May 16, 2016 2:02 PM, "Rahkonen Jukka (MML)" <
> jukka.rahko...@maanmittauslaitos.fi> wrote:
> >
> > Correction:
> >
> >
> >
> > Changing the WMS online resource does work if the mapfile is written
> correctly. I had to add VALIDATION also into MAP->WEB
> >
> >
> >
> > WEB
> >
> > METADATA
> >
> > "wms_onlineresource" "http://localhost:8060/cgi-bin/mapserv.exe?map=c
> :\ms4w\apps\wms-wfs.map=%db%"
> >
> > END #metadata
> >
> >  VALIDATION
> >
> >  "db" "[a-z]+"
> >
> > END #validation
> >
> > END #WEB
> >
> >
> >
> > Now I can send
> >
> http://localhost:8060/cgi-bin/mapserv.exe?map=c:/ms4w/apps/wms-wfs.map=wms=1.3.0=getcapabilities=wms-wfs
> >
> >
> >
> > and get
> > http://localhost:8060/cgi-bin/mapserv.exe?map=c
> :\ms4w\apps\wms-wfs.map=wms-wfs&"/>
> >
> >
> >
> > What is interesting is that the validation rule “[a-z]+” should not
> accept the name of my db “wms-wfs” but it does. Capital letters are
> accepted as well “WMS-WFS”. Because I am on Windows I can even get data
> with WMS-WFS though the name of the db is “wms-wfs.sqlite”.
> >
> That's because [a-z]+ means "there should be at least one alphabetic
> character in the passed expression". The " correct" regex to use would be
> ^[a-z]+$
>
> Thomas
> >
> >
> > -Jukka Rahkonen-
> >
> >
> >
> >
> >
> > Lähettäjä: Rahkonen Jukka (MML)
> > Lähetetty: 16. toukokuuta 2016 14:24
> > Vastaanottaja: 'G. Allegri'; mapserver-users@lists.osgeo.org
> > Aihe: Re: [mapserver-users] runtime CONNECTION string partial
> substitution
> >
> >
> >
> > Hi,
> >
> >
> >
> > I made a test with your VALIDATION and CONNECTION and changing  db
> on-the-fly works. How did you test?  If you use some WMS client for testing
> it is good to remember that variable substitution does not have an effect
> on the GetCapabilities document so that the GetMap URL would be updated
> automatically. Therefore WMS clients like QGIS or OpenJUMP will drop the
> = parameter from the GetMaps if you do not tell them not to trust the
> advertised GetMap URL.
> >
> >
> >
> > According to documentation http://mapserver.org/cgi/runsub.html  it
> should also be possible to use variable substitution also in MAP- WEB:
> METADATA. I tried
> >
> > to use
> >
> > "wms_onlineresource" “http://localhost:8060/cgi-bin/mapserv.exe?map=c
> :\ms4w\apps\wms-wfs.map&%db%”
> >
> >
> >
> > but GetCapabilities response contains the variable %db% literally
> >
> > http://localhost:8060/cgi-bin/mapserv.exe?map=c
> :\ms4w\apps\wms-wfs.map&%db%&"/>
> >
> >
> >
> > It seems that for getting a proper error message when = is missing or
> it is wrong a WMS GetMap request is required. WFS GetFeature triggers the
> error
> >
> > and is easier to write by hand, for example:
> >
> >
> http://localhost:8060/cgi-bin/mapserv.exe?map=c:/ms4w/apps/wms-wfs.map=wfs=2.0.0=getfeature=states=foo
> >
> > sends an error
> >
> > 
> >
> > msOGRFileOpen(): OGR error. Open failed for OGR connection in layer
> `states'.  File not found or unsupported format.
> >
> > 
> >
> >
> >
> > Document http://www.mapserver.org/optimization/debugging.html contains
> good advice for debugging.
> >
> >
> >
> > -Jukka Rahkonen-
> >
> >
> >
> >
> >
> > G. Allegri wrote:
> >
> >
> >
> > Hello,
> >
> > I'm trying to define a layer where the Sqlite DB 

Re: [mapserver-users] runtime CONNECTION string partial substitution

2016-05-16 Thread thomas bonfort
On May 16, 2016 2:02 PM, "Rahkonen Jukka (MML)" <
jukka.rahko...@maanmittauslaitos.fi> wrote:
>
> Correction:
>
>
>
> Changing the WMS online resource does work if the mapfile is written
correctly. I had to add VALIDATION also into MAP->WEB
>
>
>
> WEB
>
> METADATA
>
> "wms_onlineresource" "http://localhost:8060/cgi-bin/mapserv.exe?map=c
:\ms4w\apps\wms-wfs.map=%db%"
>
> END #metadata
>
>  VALIDATION
>
>  "db" "[a-z]+"
>
> END #validation
>
> END #WEB
>
>
>
> Now I can send
>
http://localhost:8060/cgi-bin/mapserv.exe?map=c:/ms4w/apps/wms-wfs.map=wms=1.3.0=getcapabilities=wms-wfs
>
>
>
> and get
> http://localhost:8060/cgi-bin/mapserv.exe?map=c
:\ms4w\apps\wms-wfs.map=wms-wfs&"/>
>
>
>
> What is interesting is that the validation rule “[a-z]+” should not
accept the name of my db “wms-wfs” but it does. Capital letters are
accepted as well “WMS-WFS”. Because I am on Windows I can even get data
with WMS-WFS though the name of the db is “wms-wfs.sqlite”.
>
That's because [a-z]+ means "there should be at least one alphabetic
character in the passed expression". The " correct" regex to use would be
^[a-z]+$

Thomas
>
>
> -Jukka Rahkonen-
>
>
>
>
>
> Lähettäjä: Rahkonen Jukka (MML)
> Lähetetty: 16. toukokuuta 2016 14:24
> Vastaanottaja: 'G. Allegri'; mapserver-users@lists.osgeo.org
> Aihe: Re: [mapserver-users] runtime CONNECTION string partial substitution
>
>
>
> Hi,
>
>
>
> I made a test with your VALIDATION and CONNECTION and changing  db
on-the-fly works. How did you test?  If you use some WMS client for testing
it is good to remember that variable substitution does not have an effect
on the GetCapabilities document so that the GetMap URL would be updated
automatically. Therefore WMS clients like QGIS or OpenJUMP will drop the
= parameter from the GetMaps if you do not tell them not to trust the
advertised GetMap URL.
>
>
>
> According to documentation http://mapserver.org/cgi/runsub.html  it
should also be possible to use variable substitution also in MAP- WEB:
METADATA. I tried
>
> to use
>
> "wms_onlineresource" “http://localhost:8060/cgi-bin/mapserv.exe?map=c
:\ms4w\apps\wms-wfs.map&%db%”
>
>
>
> but GetCapabilities response contains the variable %db% literally
>
> http://localhost:8060/cgi-bin/mapserv.exe?map=c
:\ms4w\apps\wms-wfs.map&%db%&"/>
>
>
>
> It seems that for getting a proper error message when = is missing or
it is wrong a WMS GetMap request is required. WFS GetFeature triggers the
error
>
> and is easier to write by hand, for example:
>
>
http://localhost:8060/cgi-bin/mapserv.exe?map=c:/ms4w/apps/wms-wfs.map=wfs=2.0.0=getfeature=states=foo
>
> sends an error
>
> 
>
> msOGRFileOpen(): OGR error. Open failed for OGR connection in layer
`states'.  File not found or unsupported format.
>
> 
>
>
>
> Document http://www.mapserver.org/optimization/debugging.html contains
good advice for debugging.
>
>
>
> -Jukka Rahkonen-
>
>
>
>
>
> G. Allegri wrote:
>
>
>
> Hello,
>
> I'm trying to define a layer where the Sqlite DB connection should be set
dynamically through runtime sustitution.
>
>
>
> e.g.
>
>
>
> LAYER
>
> NAME mylayer
>
> TYPE POINT
>
> CONNECTIONTYPE OGR
>
> VALIDATION
>
> "db" "[a-z]+"
>
> END
>
> CONNECTION "/var/www/dbs/%db%.sqlite"
>
> DATA "mytable"
>
> END
>
>
>
> The point layers works fine if  %db% is set statically but if I try to
define it through get query values nothing is returned:
>
>
>
> http://localhost/cgi-bin/mapserv?map=mymapfile.map=mydb
>
>
>
> The documentation says that runtime sustitution should work for
CONNECTION param too. What am I doing wrong?
>
>
>
> Thanks,
>
> Giovanni
>
>
>
> --
>
> Giovanni Allegri
> http://about.me/giovanniallegri
>
> Gis3W - http://gis3w.it
>
> Ikare - http://ikare.it
>
> Twitter: https://twitter.com/_giohappy_
>
> blog: http://blog.spaziogis.it
> GEO+ geomatica in Italia http://bit.ly/GEOplus
>
>
> ___
> mapserver-users mailing list
> mapserver-users@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] runtime CONNECTION string partial substitution

2016-05-16 Thread Rahkonen Jukka (MML)
Correction:

Changing the WMS online resource does work if the mapfile is written correctly. 
I had to add VALIDATION also into MAP->WEB

WEB
METADATA
"wms_onlineresource" 
"http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map=%db%;
END #metadata
 VALIDATION
 "db" "[a-z]+"
END #validation
END #WEB

Now I can send
http://localhost:8060/cgi-bin/mapserv.exe?map=c:/ms4w/apps/wms-wfs.map=wms=1.3.0=getcapabilities=wms-wfs

and get
http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map=wms-wfs&"/>

What is interesting is that the validation rule “[a-z]+” should not accept the 
name of my db “wms-wfs” but it does. Capital letters are accepted as well 
“WMS-WFS”. Because I am on Windows I can even get data with WMS-WFS though the 
name of the db is “wms-wfs.sqlite”.

-Jukka Rahkonen-


Lähettäjä: Rahkonen Jukka (MML)
Lähetetty: 16. toukokuuta 2016 14:24
Vastaanottaja: 'G. Allegri'; mapserver-users@lists.osgeo.org
Aihe: Re: [mapserver-users] runtime CONNECTION string partial substitution

Hi,

I made a test with your VALIDATION and CONNECTION and changing  db on-the-fly 
works. How did you test?  If you use some WMS client for testing it is good to 
remember that variable substitution does not have an effect on the 
GetCapabilities document so that the GetMap URL would be updated automatically. 
Therefore WMS clients like QGIS or OpenJUMP will drop the = parameter from 
the GetMaps if you do not tell them not to trust the advertised GetMap URL.

According to documentation http://mapserver.org/cgi/runsub.html  it should also 
be possible to use variable substitution also in MAP- WEB: METADATA. I tried
to use
"wms_onlineresource" 
“http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map&%db%<http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map&%db%25>”

but GetCapabilities response contains the variable %db% literally
http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map&%db%;<http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map&%db%25;>"/>

It seems that for getting a proper error message when = is missing or it is 
wrong a WMS GetMap request is required. WFS GetFeature triggers the error
and is easier to write by hand, for example:
http://localhost:8060/cgi-bin/mapserv.exe?map=c:/ms4w/apps/wms-wfs.map=wfs=2.0.0=getfeature=states=foo
sends an error

msOGRFileOpen(): OGR error. Open failed for OGR connection in layer `states'.  
File not found or unsupported format.


Document http://www.mapserver.org/optimization/debugging.html contains good 
advice for debugging.

-Jukka Rahkonen-


G. Allegri wrote:

Hello,
I'm trying to define a layer where the Sqlite DB connection should be set 
dynamically through runtime sustitution.

e.g.

LAYER
NAME mylayer
TYPE POINT
CONNECTIONTYPE OGR
VALIDATION
"db" "[a-z]+"
END
CONNECTION "/var/www/dbs/%db%.sqlite"
DATA "mytable"
END

The point layers works fine if  %db% is set statically but if I try to define 
it through get query values nothing is returned:

http://localhost/cgi-bin/mapserv?map=mymapfile.map=mydb

The documentation says that runtime sustitution should work for CONNECTION 
param too. What am I doing wrong?

Thanks,
Giovanni

--
Giovanni Allegri
http://about.me/giovanniallegri
Gis3W - http://gis3w.it
Ikare - http://ikare.it
Twitter: https://twitter.com/_giohappy_
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] runtime CONNECTION string partial substitution

2016-05-16 Thread Rahkonen Jukka (MML)
Hi,

I made a test with your VALIDATION and CONNECTION and changing  db on-the-fly 
works. How did you test?  If you use some WMS client for testing it is good to 
remember that variable substitution does not have an effect on the 
GetCapabilities document so that the GetMap URL would be updated automatically. 
Therefore WMS clients like QGIS or OpenJUMP will drop the = parameter from 
the GetMaps if you do not tell them not to trust the advertised GetMap URL.

According to documentation http://mapserver.org/cgi/runsub.html  it should also 
be possible to use variable substitution also in MAP- WEB: METADATA. I tried
to use
"wms_onlineresource" 
“http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map&%db%”

but GetCapabilities response contains the variable %db% literally
http://localhost:8060/cgi-bin/mapserv.exe?map=c:\ms4w\apps\wms-wfs.map&%db%&"/>

It seems that for getting a proper error message when = is missing or it is 
wrong a WMS GetMap request is required. WFS GetFeature triggers the error
and is easier to write by hand, for example:
http://localhost:8060/cgi-bin/mapserv.exe?map=c:/ms4w/apps/wms-wfs.map=wfs=2.0.0=getfeature=states=foo
sends an error

msOGRFileOpen(): OGR error. Open failed for OGR connection in layer `states'.  
File not found or unsupported format.


Document http://www.mapserver.org/optimization/debugging.html contains good 
advice for debugging.

-Jukka Rahkonen-


G. Allegri wrote:


Hello,
I'm trying to define a layer where the Sqlite DB connection should be set 
dynamically through runtime sustitution.

e.g.

LAYER
NAME mylayer
TYPE POINT
CONNECTIONTYPE OGR
VALIDATION
"db" "[a-z]+"
END
CONNECTION "/var/www/dbs/%db%.sqlite"
DATA "mytable"
END

The point layers works fine if  %db% is set statically but if I try to define 
it through get query values nothing is returned:

http://localhost/cgi-bin/mapserv?map=mymapfile.map=mydb

The documentation says that runtime sustitution should work for CONNECTION 
param too. What am I doing wrong?

Thanks,
Giovanni

--
Giovanni Allegri
http://about.me/giovanniallegri
Gis3W - http://gis3w.it
Ikare - http://ikare.it
Twitter: https://twitter.com/_giohappy_
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

[mapserver-users] runtime CONNECTION string partial substitution

2016-05-16 Thread G. Allegri
Hello,
I'm trying to define a layer where the Sqlite DB connection should be set
dynamically through runtime sustitution.

e.g.

LAYER
NAME mylayer
TYPE POINT
CONNECTIONTYPE OGR
VALIDATION
"db" "[a-z]+"
END
CONNECTION "/var/www/dbs/%db%.sqlite"
DATA "mytable"
END

The point layers works fine if  %db% is set statically but if I try to
define it through get query values nothing is returned:

http://localhost/cgi-bin/mapserv?map=mymapfile.map=mydb

The documentation says that runtime sustitution should work for CONNECTION
param too. What am I doing wrong?

Thanks,
Giovanni

-- 
Giovanni Allegri
http://about.me/giovanniallegri
Gis3W - http://gis3w.it
Ikare - http://ikare.it
Twitter: https://twitter.com/_giohappy_
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users