[mapserver-users] drawing multiple layers from postgis

thomas bonfort thomas.bonfort at gmail.com
Fri Aug 9 08:44:02 PDT 2013


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