[Mapserver-users] mysql layers cant be drawn

Murat Isik muratisik at megatek.com.tr
Thu Feb 26 07:52:06 PST 2004


This is a multi-part message in MIME format...

------=_NextPart_000_078B_01C3FC91.3FB72310
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hello,

I am developing a php map site which has only one city and several layers w=
ithin that  city. Until recently all layers were defined in the mapfile, ph=
p function only called them by name and turned them on.The maps were genera=
ted perfectly. Then I decided to move all my php-called layers to mysql and=
 created a table with coloumns for all needed values for any layer definiti=
on. I only left the always-ON layers in the map file. After I did this excl=
uding the mapfile layers I could not get the mapscript to draw the maps for=
 more than 16 mysql  based layers, and that includes any combination of my =
25 mysql layers. No map is rendered and no error is recorded in niether htt=
pd log nor anywhere else.  I set the php process time out to limitless but =
nothing changed. I found it very puzzling to be limited to only 16 mysql la=
yers, a weird number.=20

My system properties:

Redhat 9, mapserver/mapscript 4.0.1 , mysql 3.23

This is the code I use to read layer properties off the database and have l=
ayers generated:

for($ltn=3D1;$ltn<=3D3;$ltn++)=20=20=20=20=20=20
{

if($ltn=3D=3D1)
{
        $layertype=3D"MS_LAYER_POLYGON";
}elseif($ltn=3D=3D2)
        {
                $layertype=3D"MS_LAYER_LINE";
        }else{
                $layertype=3D"MS_LAYER_POINT";
                }


$result =3D mysql_query("select * from layer_styles where type=3D'$layertyp=
e' and status=3D'MS_ON' and scale_factor_max>'$scale_factor_x' and scale_fa=
ctor_min<=3D'$scale_factor_x' order by id") or die (mysql_error());

while ($row =3D mysql_fetch_array($result))
        {

                if($xmin>=3D$row["extentminx"] && $ymin>=3D$row["extentminy=
"] && $xmax<=3D$row["extentmaxx"] && $ymax<=3D$row["extentmaxy"])
                        {


                                $layer =3D ms_newLayerObj($map);
                                $layer->set("name",$row["name"]);
                                if($ltn=3D=3D1){$layer->set("type",MS_LAYER=
_POLYGON);}elseif($ltn=3D=3D2){$layer->set("type",MS_LAYER_LINE);}else{$lay=
er->set("type",MS_LAYER_POINT);}
                                if($row["status"]=3D=3D"MS_ON"){$layer->set=
("status",MS_ON);}else{$layer->set("status",MS_OFF);}
                                if($row["dynamic"]=3D=3D0){$layer->set("dat=
a","/var/www/html/mapserver/data/".$row["data"]);}else{$layer->set("data","=
/var/www/html/mapserver/dynamicdata/".$row["data"]);}
                                if($row["labelcache"]=3D=3D"MS_ON"){$layer-=
>set("labelcache",MS_ON);}else{$layer->set("labelcache",MS_OFF);}
                                if($row["labelitem"]!=3D"0"){$layer->set("l=
abelitem", $row["labelitem"]);}
                                $class =3D ms_newClassObj($layer);
                                if($row["namedisplay"]!=3D0){$class->set("n=
ame",$row["classname"]);}
                                $style=3Dms_newStyleObj($class);
                                $colors=3Dexplode(" ",$row["stylecolor"]);
                                $style->color->setRGB($colors[0],$colors[1]=
,$colors[2]);
                                if($row["styleoutlinecolor"]!=3D"YOK")
                                        {
                                                $outsidecolors=3Dexplode(" =
",$row["styleoutlinecolor"]);
                                         $style->outlinecolor->setRGB($outs=
idecolors[0],$outsidecolors[1],$outsidecolors[2]);
                                        }
                                if($ltn=3D=3D2 || $ltn=3D=3D3)
                                        {
                                                $style->set("symbol",$row["=
stylesymbol"]);
                                                $style->set("size",$row["st=
ylesize"]);
                                        }
                                $class->{label}->set('size', $row["labelsiz=
e"]);
                                $class->{label}->set('minsize', 2 );
                                if($row["labelposition"]=3D=3D"MS_AUTO"){$c=
lass->{label}->set('position',MS_AUTO);}elseif($row["labelposition"]=3D=3D"=
MS_UL"){$class->{label}->set('position',MS_UL);}elseif($row["labelposition"=
]=3D=3D"MS_LR"){$class->{label}->set('position',MS_LR);}elseif($row["labelp=
osition"]=3D=3D"MS_UR"){$class->{label}->set('position',MS_UR);}elseif($row=
["labelposition"]=3D=3D"MS_LL"){$class->{label}->set('position',MS_LL);}els=
eif($row["labelposition"]=3D=3D"MS_CR"){$class->{label}->set('position',MS_=
CR);}elseif($row["labelposition"]=3D=3D"MS_CL"){$class->{label}->set('posit=
ion',MS_CL);}elseif($row["labelposition"]=3D=3D"MS_UC"){$class->{label}->se=
t('position',MS_UC);}elseif($row["labelposition"]=3D=3D"MS_CC"){$class->{la=
bel}->set('position',MS_CC);}


                                if($row["labelautoangle"]=3D=3D1){$class->{=
label}->set('autoangle',1);}
                                $color_label=3Dexplode(" ",$row["labelcolor=
"]);
                                $class->{label}->color->setRGB($color_label=
[0],$color_label[1],$color_label[2]);
                                $class->{label}->set('font',$row["labelfont=
"]);
                                if($row["labeltype"]=3D=3D"MS_TRUETYPE"){$c=
lass->{label}->set('type',MS_TRUETYPE);}else{$class->{label}->set('type',MS=
_BITMAP);}

$w++;

                        }

        }


mysql_free_result($result);


}


$image=3D$map->draw();



Is there a syntax error? I dont thinks o, if there were why would it only w=
ork with 16 only instead of none.

Have a nice day,

Murat Isik


------=_NextPart_000_078B_01C3FC91.3FB72310--



More information about the MapServer-users mailing list