[Mapserver-users] Problems with in multi-layer maps (postGIS or mapServer?) - find_srid

Ignacio Laplagne laplagnegeo at softhome.net
Wed Jun 11 17:46:40 EDT 2003


This is a multi-part message in MIME format.

------=_NextPart_000_002B_01C33049.DF9CFFE0
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Hi,

We are working with mapServer+postGIS and are having a problem which we
believe is due to a bug (we cannot make sure whether this is due to
postGIS or mapServer; it could be even due to postgreSQL?): when working
with multi-layer map files with "complex" data and filter sections, the
resulting queries sent to PostgreSQL seem to be definitely wrong.
Consider the map file attached, and the first two layers. The DATA
section in layer "deptos" (supposedly the first to be drawn) causes the
following query being sent to postgreSQL:

DECLARE mycursor BINARY CURSOR FOR SELECT
porc::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::tex
t from ( select gid as oid, deptos.the_geom, p.prov as prov, p.porc as
porc, p.id_a as id_a, p.ed as ed from paisdeptos97 deptos join
calc__porc_x_ed_x_indra_x_alianza_c p on deptos.indra=cast(p.indra as
character varying)) as foo WHERE (foo.ed=112 AND foo.id_a=1 AND (0=1 OR
foo.prov='04')) and (the_geom && setSRID( 'BOX3D(3233646.7768
6112213.86,4187074.2232
6748025.14)'::BOX3D,find_srid('','paisdeptos97','the_geom') ))

Everything is just fine with this (believe me!). However, the second
layer causes the following query to be sent to postgres:

DECLARE mycursor BINARY CURSOR FOR SELECT
porc::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::tex
t from ( select gid as oid, c.the_geom, p.prov as prov, p.porc as porc,
p.id_a as id_a, p.ed as ed from circuito c join
calc__porc_x_ed_x_indrac_x_alianza_c p on c.indra=cast(p.indra as
character varying)) as foo WHERE (foo.ed=112 AND foo.id_a=1 AND (0=1 OR
foo.prov='04')) and (the_geom && setSRID( 'BOX3D(3233646.7768
6112213.86,4187074.2232 6748025.14)':
:BOX3D,find_srid('','circuitoos97','the_geom') ))

The big problem with this new query is the call to find_srid (in the
last line): 

find_srid('','circuitoos97','the_geom')

Now, the name "circuitoos97" doesn't correspond to any table mentioned
in the data section of the file, or any table in the database. Indeed,
this name would correspond to writing the word "circuito" OVER THE SAME
MEMORY POSITION than the word "paisdeptos97", which is exactly the name
used in the first call to the function find_srid (you can see it on the
query generated to draw the first layer). This suggests that somewhere
there is some piece of code missing for erasing the contents of that
memory position, or setting the right limit for these strings, etc.

Any suggestion or patch for this? We are currently working with the
following environment:

Redhat linux 8.0
postgreSQL 7.3.2
postgis 0.7.5
mapServer 3.6.5


Thanks in advance,
Ignacio Laplagne


------=_NextPart_000_002B_01C33049.DF9CFFE0
Content-Type: application/octet-stream;
	name="mpac.map"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="mpac.map"

#
# mpa =3D mapa de alianzas
#
name mapin

EXTENT 2952219 3899185 4740795 7592801

size 900 600
symbolset "/var/www/html/ews/v1.0/symbols/symbols35.sym"

web
  template tM1j.html
  imagepath "/var/www/html/tmp/"
  imageurl "/tmp/"
end

querymap
  size 200 150
  status on
  style hilite
  color 255 128 0
end

scalebar
  imagecolor 255 255 255
  label
    color 0 0 0
    size tiny
  end
  style 1
  size 72 3
  color 0 0 0
  units kilometers
  intervals 2
  transparent true
  status embed
  position lr
end

legend
  status on
  label
    type bitmap
    size medium
    color 0 0 0
  end
end

reference
  status on
  image "/var/www/html/ews/v1.0/images/pais.png"
  size 150 108
  extent 2952219 3899185 4740795 7592801
  color -1 -1 -1
  outlinecolor 255 0 0
end


# layer definitions ---------------------------------------------

LAYER
	CONNECTIONTYPE postgis
	NAME "deptos"
	CONNECTION "user=3Dpostgres dbname=3Dgisdb"
	data "the_geom from ( select gid as oid, deptos.the_geom, p.prov as =
prov, p.porc as porc, p.id_a as id_a, p.ed as ed from paisdeptos97 =
deptos join calc__porc_x_ed_x_indra_x_alianza_c p on =
deptos.indra=3Dcast(p.indra as character varying)) as foo"
	filter "foo.ed=3D%MPed% AND foo.id_a=3D%MPpp% AND (%MPsap%=3D1 OR =
foo.prov=3D'%MPprov%')"
	STATUS DEFAULT
	TYPE POLYGON

	CLASS EXPRESSION ([porc] >  0.60) COLOR 0   0   0   OUTLINECOLOR 0   0  =
 0   END
	CLASS EXPRESSION ([porc] >  0.45) COLOR 107 0   0   OUTLINECOLOR 107 0  =
 0   END
	CLASS EXPRESSION ([porc] >  0.40) COLOR 157 0   0   OUTLINECOLOR 157 0  =
 0   END
	CLASS EXPRESSION ([porc] >  0.35) COLOR 223 0   0   OUTLINECOLOR 223 0  =
 0   END
	CLASS EXPRESSION ([porc] >  0.30) COLOR 254 0   0   OUTLINECOLOR 254 0  =
 0   END
	CLASS EXPRESSION ([porc] >  0.27) COLOR 209 93  0   OUTLINECOLOR 209 93 =
 0   END
	CLASS EXPRESSION ([porc] >  0.24) COLOR 233 105 0   OUTLINECOLOR 233 =
105 0   END
	CLASS EXPRESSION ([porc] >  0.21) COLOR 254 114 0   OUTLINECOLOR 254 =
114 0   END
	CLASS EXPRESSION ([porc] >  0.18) COLOR 254 135 40  OUTLINECOLOR 254 =
135 40  END
	CLASS EXPRESSION ([porc] >  0.15) COLOR 254 154 74  OUTLINECOLOR 254 =
154 74  END
	CLASS EXPRESSION ([porc] >  0.12) COLOR 254 172 105 OUTLINECOLOR 254 =
172 105 END
	CLASS EXPRESSION ([porc] >  0.09) COLOR 254 188 135 OUTLINECOLOR 254 =
188 135 END
	CLASS EXPRESSION ([porc] >  0.06) COLOR 254 204 165 OUTLINECOLOR 254 =
204 165 END
	CLASS EXPRESSION ([porc] >  0.03) COLOR 254 221 195 OUTLINECOLOR 254 =
221 195 END
	CLASS EXPRESSION ([porc] > 0.02)  COLOR 254 237 225	OUTLINECOLOR 254 =
237 225 END
	CLASS EXPRESSION ([porc] > 0.01)  COLOR 254 249 225	OUTLINECOLOR 254 =
249 225 END
	CLASS EXPRESSION ([porc] > 0.008) COLOR 139 139 139	OUTLINECOLOR 139 =
139 139 END
	CLASS EXPRESSION ([porc] > 0.006) COLOR 180 180 180	OUTLINECOLOR 180 =
180 180 END
	CLASS EXPRESSION ([porc] > 0.004) COLOR 219 219 219	OUTLINECOLOR 219 =
219 219 END
	CLASS EXPRESSION ([porc] > 0.000001) COLOR 250 250 250 OUTLINECOLOR 250 =
250 250 END
	CLASS EXPRESSION ([porc] < 0.000001) COLOR 255 255 255 OUTLINECOLOR 255 =
255 255 END
END


LAYER
        CONNECTIONTYPE postgis
        NAME "circuitos"
        CONNECTION "user=3Dpostgres dbname=3Dgisdb"
        TRANSPARENCY 90
        data "the_geom from ( select gid as oid, c.the_geom, p.prov as =
prov, p.porc as porc, p.id_a as id_a, p.ed as ed from circuito c join =
calc__porc_x_ed_x_indrac_x_alianza_c p on c.indra=3Dcast(p.indra as =
character varying)) as foo"
        filter "foo.ed=3D%MPed% AND foo.id_a=3D%MPpp% AND (%MPsap%=3D1 =
OR foo.prov=3D'%MPprov%')"
        STATUS DEFAULT
        TYPE POLYGON

        CLASS EXPRESSION ([porc] > 0.60)     COLOR 0   0   0   =
OUTLINECOLOR 0   0   0   END
        CLASS EXPRESSION ([porc] > 0.45)     COLOR 107 0   0   =
OUTLINECOLOR 107 0   0   END
        CLASS EXPRESSION ([porc] > 0.40)     COLOR 157 0   0   =
OUTLINECOLOR 157 0   0   END
        CLASS EXPRESSION ([porc] > 0.35)     COLOR 223 0   0   =
OUTLINECOLOR 223 0   0   END
        CLASS EXPRESSION ([porc] > 0.30)     COLOR 254 0   0   =
OUTLINECOLOR 254 0   0   END
        CLASS EXPRESSION ([porc] > 0.27)     COLOR 209 93  0   =
OUTLINECOLOR 209 93  0   END
        CLASS EXPRESSION ([porc] > 0.24)     COLOR 233 105 0   =
OUTLINECOLOR 233 105 0   END
        CLASS EXPRESSION ([porc] > 0.21)     COLOR 254 114 0   =
OUTLINECOLOR 254 114 0   END
        CLASS EXPRESSION ([porc] > 0.18)     COLOR 254 135 40  =
OUTLINECOLOR 254 135 40  END
        CLASS EXPRESSION ([porc] > 0.15)     COLOR 254 154 74  =
OUTLINECOLOR 254 154 74  END
        CLASS EXPRESSION ([porc] > 0.12)     COLOR 254 172 105 =
OUTLINECOLOR 254 172 105 END
        CLASS EXPRESSION ([porc] > 0.09)     COLOR 254 188 135 =
OUTLINECOLOR 254 188 135 END
        CLASS EXPRESSION ([porc] > 0.06)     COLOR 254 204 165 =
OUTLINECOLOR 254 204 165 END
        CLASS EXPRESSION ([porc] > 0.03)     COLOR 254 221 195 =
OUTLINECOLOR 254 221 195 END
        CLASS EXPRESSION ([porc] > 0.02)     COLOR 254 237 225 =
OUTLINECOLOR 254 237 225 END
        CLASS EXPRESSION ([porc] > 0.01)     COLOR 254 249 225 =
OUTLINECOLOR 254 249 225 END
        CLASS EXPRESSION ([porc] > 0.008)    COLOR 139 139 139 =
OUTLINECOLOR 139 139 139 END
        CLASS EXPRESSION ([porc] > 0.006)    COLOR 180 180 180 =
OUTLINECOLOR 180 180 180 END
        CLASS EXPRESSION ([porc] > 0.004)    COLOR 219 219 219 =
OUTLINECOLOR 219 219 219 END
        CLASS EXPRESSION ([porc] > 0.000001) COLOR 250 250 250 =
OUTLINECOLOR 250 250 250 END
        CLASS EXPRESSION ([porc] < 0.000001) COLOR 255 255 255 =
OUTLINECOLOR 255 255 255 END

        STATUS DEFAULT
        TYPE POLYGON
END


LAYER
	CONNECTIONTYPE postgis
	NAME "deptos_vacios"
	CONNECTION "user=3Dpostgres dbname=3Dgisdb"
	data "the_geom from paisdeptos97"
	CLASS SYMBOL 'circle' SIZE 1 OUTLINECOLOR 0 0 0 END
	STATUS DEFAULT
	TYPE POLYGON
END

LAYER
	CONNECTIONTYPE postgis
	NAME "provincias"
	CONNECTION "user=3Dpostgres dbname=3Dgisdb"
	data "the_geom from provincias"
	CLASS SYMBOL 'circle' SIZE 2 OUTLINECOLOR 0 0 0 END
	STATUS DEFAULT
	TYPE POLYGON
END

# end of layer defs -------------------------------

END # end of map file



------=_NextPart_000_002B_01C33049.DF9CFFE0--




More information about the mapserver-users mailing list