[mapserver-users] drawing multiple layers from postgis
thomas bonfort
thomas.bonfort at gmail.com
Fri Aug 9 08:57:32 PDT 2013
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/business1.map&layers=business_rd1%20states&mode=map
>> >
>> >
>> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/business2.map&layers=business_rd2%20states&mode=map
>> >
>> >
>> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/business3.map&layers=business_rd3%20states&mode=map
>> >
>> >
>> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/business4.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/business1.map&layers=business_rd1%20states&mode=map
>> >
>> >
>> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/business2.map&layers=business_rd2%20states&mode=map
>> >
>> >
>> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/business3.map&layers=business_rd3%20states&mode=map
>> >
>> >
>> > http://localhost/cgi-bin/mapserv?map=/media/D_Drive/www/gis/business4.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
>> >
More information about the MapServer-users
mailing list