[mapserver-users] drawing multiple layers from postgis

Michael McInnis mmcinnis59 at msn.com
Fri Aug 9 09:15:17 PDT 2013


Nice work Thomas! That's got it.
http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/business.map&layers=business_rd4%20states&mode=map

Now I can call any of the 4 from one .map file.
Now I just need to figure out how to call a specific layer via a .php file.
Thanks a lot, very subtle change there Adding STYLE in front of SYMBOL.

Michael McInnis
6033 44th Ave. N.E.
Seattle, WA 98115
206 517-4701

> From: bob.basques at ci.stpaul.mn.us
> CC: mapserver-users at lists.osgeo.org
> Date: Fri, 9 Aug 2013 16:02:31 +0000
> Subject: Re: [mapserver-users] drawing multiple layers from postgis
> 
> Thomas,
> 
> Oh man!!  That's a subtle piece of info, any reason the END can't be left in there as a default somehow or at least ignored inside of the STYLE block, I can see this coming back to bite folks over time with the two different formats for SYMBOL/(and sometime END) combos.
> 
> 
> 
> Bobb
> 
> 
> 
> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of thomas bonfort
> Sent: Friday, August 09, 2013 10:58 AM
> To: Michael McInnis
> Cc: mapserver-users at lists.osgeo.org
> Subject: Re: [mapserver-users] drawing multiple layers from postgis
> 
> third time's a charm :)
> 
> LAYER
>         NAME business_rd1
>         CONNECTIONTYPE POSTGIS
>         CONNECTION "host=localhost dbname=Business user=postgres password=xxxx port=5432"
>         DATA "geom From business_rd1 as rd1 using unique id using srid=4326"
>         PROCESSING "CLOSE_CONNECTION=DEFER"
>         #MINSCALE 10000000
> STATUS ON
>         TYPE POINT
>         CLASS
>            STYLE
>               SYMBOL 'circle'
>               SIZE 2
>               COLOR 255 0 0
>            END #Style
>         END # Class
>     END # Layer
> 
> symbol takes an END when you're defining a symbol , not when referencing it in a style.
> 
> On 9 August 2013 17:55, Michael McInnis <mmcinnis59 at msn.com> wrote:
> > Thomas,
> >
> > Here is my complete map file when all the postgis layers are combined. 
> > Like I said, I can call all of these layers if I put just one layer in 
> > a .map file but can't get it to work with more than one.
> >
> > Thanks!
> >
> > MAP
> >     DEBUG 5
> >     CONFIG "MS_ERRORFILE" "/media/D_Drive/www/gis/logs/error_file.log"
> >     EXTENT -126 25 -64 50
> >     #EXTENT -123 47 -122 48
> >     IMAGECOLOR 153 179 204
> >     IMAGETYPE PNG24
> >     SHAPEPATH data/
> >     FONTSET data/fonts/fonts.list
> >     SIZE 1000 500
> >     #SIZE 800 800
> >     #SCALEDENOM 50000
> >     UNITS DD
> >     PROJECTION
> > "+proj=longlat +ellps=WGS84"
> >     END
> >     OUTPUTFORMAT
> > NAME png
> > DRIVER "AGG/PNG"
> > MIMETYPE "image/png"
> > IMAGEMODE RGBA
> > EXTENSION "png"
> >     END
> >     WEB
> > IMAGEPATH "/media/D_Drive/www/gis/tmp/"
> > IMAGEURL "gis/tmp/"
> >     END
> >
> >     SYMBOL
> >         NAME "circle"
> >         TYPE ELLIPSE
> >         FILLED TRUE
> >         POINTS 1 1 END
> >     END
> >
> >     LAYER
> >         NAME states
> >         DATA STATES
> >         STATUS ON
> >         TYPE Polygon
> >
> >         CLASS
> >             OUTLINECOLOR 255 255 255
> >             COLOR 155 155 155
> >         END # Class
> >     END # Layer
> >
> >     LAYER
> >         NAME business_rd1
> >         CONNECTIONTYPE POSTGIS
> >         CONNECTION "host=localhost dbname=Business user=postgres 
> > password=xxxx port=5432"
> >         DATA "geom From business_rd1 as rd1 using unique id using srid=4326"
> >         PROCESSING "CLOSE_CONNECTION=DEFER"
> >         #MINSCALE 10000000
> > STATUS ON
> >         TYPE POINT
> >         CLASS
> >             SYMBOL 'circle'
> >                 SIZE 2
> >                 COLOR 255 0 0
> >             END
> >         END # Class
> >     END # Layer
> >
> >     LAYER
> >         NAME business_rd2
> >         CONNECTIONTYPE POSTGIS
> >         CONNECTION "host=localhost dbname=Business user=postgres 
> > password=xxxxx port=5432"
> >         DATA "geom From business_rd2 as rd2 using unique id using srid=4326"
> >         PROCESSING "CLOSE_CONNECTION=DEFER"
> >         #MINSCALE 1000000
> > STATUS ON
> >         TYPE POINT
> >         CLASS
> >             SYMBOL 'circle'
> >                 SIZE 2
> >                 COLOR 0 255 0
> >             END
> >         END # Class
> >     END # Layer
> >
> >     LAYER
> >         NAME business_rd3
> >         CONNECTIONTYPE POSTGIS
> >         CONNECTION "host=localhost dbname=Business user=postgres 
> > password=xxxx port=5432"
> >         DATA "geom From business_rd3 as rd3 using unique id using srid=4326"
> >         PROCESSING "CLOSE_CONNECTION=DEFER"
> >         #MINSCALE 100000
> > STATUS ON
> >         TYPE POINT
> >         CLASS
> >             SYMBOL 'circle'
> >                 SIZE 2
> >                 COLOR 0 0 255
> >             END
> >         END # Class
> >     END # Layer
> >
> >     LAYER
> >         NAME business_rd4
> >         CONNECTIONTYPE POSTGIS
> >         CONNECTION "host=localhost dbname=Business user=postgres 
> > password=xxxxx port=5432"
> >         DATA "geom From business_rd4 as rd4 using unique id using srid=4326"
> >         PROCESSING "CLOSE_CONNECTION=DEFER"
> >         #MINSCALE 10000
> > STATUS ON
> >         TYPE POINT
> >         CLASS
> >             SYMBOL 'circle'
> >                 SIZE 2
> >                 COLOR 255 0 255
> >             END
> >         END # Class
> >     END # Layer
> > END # Map File
> >
> >
> > Michael McInnis 6033 44th Ave. N.E. Seattle, WA 98115 206 517-4701
> >
> >> Date: Fri, 9 Aug 2013 17:44:02 +0200
> >
> >> Subject: Re: [mapserver-users] drawing multiple layers from postgis
> >> From: thomas.bonfort at gmail.com
> >> To: mmcinnis59 at msn.com
> >> CC: mapserver-users at lists.osgeo.org
> >
> >>
> >> https://github.com/mapserver/mapserver/issues/2922
> >>
> >> On 9 August 2013 17:40, Michael McInnis <mmcinnis59 at msn.com> wrote:
> >> >
> >> > I'm pretty sure that END is correctly ending the Symbol Clause.
> >> >
> >> > The odd thing about this is I can draw all four layers if I call 
> >> > them separately but when I try to call them through php only 
> >> > numbers 1 and 3 work. All layers were generated the same way in 
> >> > postgresql/postgis (see sql below).
> >> >
> >> > I'm going to regenerate layers 2 and 4 just in case but I think 
> >> > it's a problem with php/ms_script.
> >> >
> >> > // All these work
> >> >
> >> >
> >> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/busines
> >> > s1.map&layers=business_rd1%20states&mode=map
> >> >
> >> >
> >> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/busines
> >> > s2.map&layers=business_rd2%20states&mode=map
> >> >
> >> >
> >> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/busines
> >> > s3.map&layers=business_rd3%20states&mode=map
> >> >
> >> >
> >> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/busines
> >> > s4.map&layers=business_rd4%20states&mode=map
> >> >
> >> >
> >> >
> >> > // Half of these work
> >> >
> >> > http://mapserver0/business.php?num=1 works
> >> >
> >> > http://mapserver0/business.php?num=2 not
> >> >
> >> > http://mapserver0/business.php?num=3 works
> >> >
> >> > http://mapserver0/business.php?num=4 not
> >> >
> >> >
> >> >
> >> > // All these work
> >> >
> >> >
> >> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/busines
> >> > s1.map&layers=business_rd1%20states&mode=map
> >> >
> >> >
> >> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/busines
> >> > s2.map&layers=business_rd2%20states&mode=map
> >> >
> >> >
> >> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/busines
> >> > s3.map&layers=business_rd3%20states&mode=map
> >> >
> >> >
> >> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/busines
> >> > s4.map&layers=business_rd4%20states&mode=map
> >> >
> >> >
> >> >
> >> > // Half of these work
> >> >
> >> > http://mapserver0/business.php?num=1 works
> >> >
> >> > http://mapserver0/business.php?num=2 not
> >> >
> >> > http://mapserver0/business.php?num=3 works
> >> >
> >> > http://mapserver0/business.php?num=4 not
> >> >
> >> >
> >> > // Create rounded lat lon table
> >> >
> >> > Select count(*), round(cast(ST_X(geom) as numeric),2) as lon,
> >> >
> >> > round(cast(ST_Y(geom) as numeric),2) as lat
> >> >
> >> > Into business_rd2
> >> >
> >> > From business_loc
> >> >
> >> > Group By round(cast(ST_X(geom) as numeric),2), 
> >> > round(cast(ST_Y(geom) as
> >> > numeric),2)
> >> >
> >> > Order By count Desc
> >> >
> >> >
> >> >
> >> > // Add Geometry
> >> >
> >> > Alter Table business_rd2 Add Column geom geometry(POINT,4326);
> >> >
> >> > Update business_rd2 Set geom = 
> >> > ST_SetSRID(ST_MakePoint(lon,lat),4326);
> >> >
> >> > Create Index indx_business_rd2_geom On business_rd2 Using 
> >> > GIST(geom);
> >> >
> >> >
> >> >
> >> > // Now add a primary key named id to enable mapserver drawing
> >> >
> >> > Alter Table business_rd2 Add Column id BIGSERIAL Primary Key;
> >> >
> >> >
> >> >
> >> >> Date: Fri, 9 Aug 2013 12:23:52 +0200
> >> >> Subject: Re: [mapserver-users] drawing multiple layers from 
> >> >> postgis
> >> >> From: thomas.bonfort at gmail.com
> >> >> To: mmcinnis59 at msn.com
> >> >>
> >> >> On 8 August 2013 20:16, Michael McInnis <mmcinnis59 at msn.com> wrote:
> >> >> > Hopefully, this is an easy one.
> >> >> >
> >> >> > I'm trying to build a scale sensitive .map file using points 
> >> >> > from postgis.
> >> >> >
> >> >> > I can successfully draw the shapefile states with a single 
> >> >> > points layer from postgis.
> >> >> > However, if I add an additional points layer and attempt to draw 
> >> >> > it the layer comes up blank.
> >> >> > If I remove the leading postgis points layer from the .map file 
> >> >> > the new points layer will now display.
> >> >> > IE I can only draw the first occurrence of a postgis layer in 
> >> >> > the map file.
> >> >> >
> >> >> > How do you define multiple postgis layers so that you can pick 
> >> >> > and choose layers for display?
> >> >> >
> >> >> > LAYER
> >> >> > NAME states
> >> >> > DATA STATES
> >> >> > STATUS ON
> >> >> > TYPE Polygon
> >> >> >
> >> >> > CLASS
> >> >> > OUTLINECOLOR 255 255 255
> >> >> > COLOR 155 155 155
> >> >> > END # Class
> >> >> > END # Layer
> >> >> >
> >> >> > LAYER
> >> >> > CONNECTIONTYPE POSTGIS
> >> >> > NAME business_rd2
> >> >> > CONNECTION "host=localhost dbname=Business user=postgres 
> >> >> > password=xxxx port=5432"
> >> >> > PROCESSING "CLOSE_CONNECTION=DEFER"
> >> >> > DATA "geom From business_rd2 as rd2 using unique id using srid=4326"
> >> >> > #MINSCALE 100000
> >> >> > STATUS ON
> >> >> > TYPE POINT
> >> >> > CLASS
> >> >> > SYMBOL 'circle'
> >> >> > SIZE 2
> >> >> > COLOR 255 0 0
> >> >> > END
> >> >> this END is bogus
> >> >>
> >> >> > END # Class
> >> >> > END # Layer
> >> >> >
> >> >> > LAYER
> >> >> > CONNECTIONTYPE POSTGIS
> >> >> > NAME business_rd1
> >> >> > CONNECTION "host=localhost dbname=Business user=postgres 
> >> >> > password=xxxx port=5432"
> >> >> > PROCESSING "CLOSE_CONNECTION=DEFER"
> >> >> > DATA "geom From business_rd1 as rd1 using unique id using srid=4326"
> >> >> > #MINSCALE 100000
> >> >> > STATUS ON
> >> >> > TYPE POINT
> >> >> > CLASS
> >> >> > SYMBOL 'circle'
> >> >> > SIZE 2
> >> >> > COLOR 255 0 0
> >> >> > END
> >> >> this one to
> >> >>
> >> >> > END # Class
> >> >> > END # Layer
> >> >> >
> >> >> >
> >> >> > _______________________________________________
> >> >> > mapserver-users mailing list
> >> >> > mapserver-users at lists.osgeo.org
> >> >> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> >> >> >
> >> >
> >> > _______________________________________________
> >> > mapserver-users mailing list
> >> > mapserver-users at lists.osgeo.org
> >> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> >> >
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20130809/0c8e3512/attachment-0001.html>


More information about the mapserver-users mailing list