[mapserver-users] Mapserver JOIN to html template

Jeff McKenna jmckenna at gatewaygeomatics.com
Thu Mar 10 13:13:57 PST 2016


Hi Pierre-Etienne,

Here are some thoughts if I was heading down your path:

- before any query is tested, I'd verify that each of my PostGIS tables 
have OIDs (unique identifiers, which are required for queries through 
MapServer and QGIS, this is a setting when creating a table, and is also 
a switch in shp2pgsql and ogr2ogr during import I believe)
- then I would test a PostGIS layer, not joined, and query it through 
normal mapserv CGI in your web browser (not through WMS/GetFeatureInfo)
- once my normal CGI query works with a non-joined PostGIS layer, I'd 
move onto join/WMS
- once at join/WMS, I'd try generating a GetFeatureInfo request (even 
using something like QGIS, its identify button, with your WMS service)
- I'd also test through my browser/application, and look in the 
"Network" tab of the developer tools/firebug, and see what message is 
returned by MapServer for the GetFeatureInfo request

Those are my initial thoughts.

(and remembering creating those join examples ha, it's Canadian 
"prov"inces everywhere ha)

-jeff



-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/



On 2016-03-10 2:48 PM, Pierre-Étienne Lord wrote:
> Hi everybody, it's my first question ever on this list.
>
> <mailto:mapserver-users%40lists.osgeo.org>
> Some facts before
>
> I'm running Mapserver 6.2.1  (old vm machine)
> Postgres 9.3.6 with postgis 2.1.7
> Postgres is listening all IP and accept all incoming IP. pg_hba.conf an
> postgresql.conf
> Publishing succesfully multiple layers base on Postgis and everything
> seem to be ok.
>
> I try to make a template presenting ONE-TO-MANY content from PG to
> PG.(http://mapserver.org/mapfile/join.html)
> My ONE part is my geometry and is published in WMS
> My MANY is an associated table.
> My key between my 2 tables is a unique string (21) named geocode
> Both have PK.
>
>
> Here my problem.
>
> On getfeatureinfo, it is suppose to return a html mime type for my
> template. Header, central (MANY) and FOOTER.
> When I call the same dataset in DBF, the getfeatureinfo is returned
> properly.
> When I call the same dataset in postgres, the getfeatureinfo is NOT
> returned properly.
> I think that my connection is well done by connection string because if
> I change table or column name to a not existing one, MapServer raise an
> error.
>
>
> This example don't work properly.
>
> TEMPLATE "oneToMany.html"
> HEADER "oneToMany_header.html"
> FOOTER "oneToMany_footer.html"
>
> JOIN
>          NAME 'ieqm'
>          CONNECTIONTYPE postgresql
>          CONNECTION "host=XX.XX.XX.XX port=XXXX user=PG password=PGPWD
> dbname=BDX"
>          TABLE 'table_150513"
>          FROM 'geocode'
>          TO 'geocode'
>          TYPE ONE-TO-MANY
>          TEMPLATE 'oneToMany_join.html'
>      END
>
>
>
> This example work properly.
>
> TEMPLATE "oneToMany.html"
> HEADER "oneToMany_header.html"
> FOOTER "oneToMany_footer.html"
>
> JOIN
>          NAME 'ieqm'
>          TABLE "table_150513.dbf"
>          FROM 'geocode'
>          TO 'geocode'
>          TYPE ONE-TO-MANY
>          TEMPLATE 'oneToMany_join.html'
>      END
>
>
> Thanks!
>
> Pierre-Étienne Lord
>
> <https://outlook.mrnf.gouv.qc.ca/owa/redir.aspx?SURL=YaZ5UYf2IPMJv7ADsBDnNhbct83j8H_NQZOvg_R1SvvMdStAFEnTCG0AYQBpAGwAdABvADoAcABpAGUAcgByAGUALQBlAHQAaQBlAG4AbgBlAC4AbABvAHIAZABAAG0AZgBmAHAALgBnAG8AdQB2AC4AcQBjAC4AYwBhAA..&URL=mailto%3apierre-etienne.lord%40mffp.gouv.qc.ca>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>




More information about the mapserver-users mailing list