blank map when a layer is defined from php

Yewondwossen Assefa assefa at DMSOLUTIONS.CA
Mon Apr 4 17:41:09 EDT 2005


I think you should use something like :

  $layer->set(connectiontype,MS_POSTGIS) instead of

  $layer->set(connectiontype, "postgis");

Later,


Shashi Gireddy wrote:
> I spent a lot of time on it. I didn't found any solution. Is it
> appears to be a bug. because it is trying to open the expression as
> file, here is the error.
>
> Warning: [MapServer Error]: msSHPOpenFile(): (c:/ms/map_files/the geom
> from counties) in c:\inetpub\wwwroot\mapExamples\map3.php on line 22
> here "the geom from counties" is the select statement. anybody has any idea.
>
> thank you,
> shashi.
>
>
> On Feb 21, 2005 4:29 PM, Shashi Gireddy <gireddy at gmail.com> wrote:
>
>>Hi all,
>>Thank you steven and Stephen for helping me in removing label
>>overlapping.I really appreciate your help.  I am perfectly able to
>>join the geometry object with external database.  Now I want to make
>>everything dynamic, i.e generate layers dynamically from php. I had a
>>problem doing so.
>>
>>I am getting a blank map when i tried to generate layers dynamically
>>from php, here is my code
>>
>>$map_path="c:/ms/map_files/";
>>  $map_file="Test.map";
>>
>>$map = ms_newMapObj($map_path.$map_file);
>>$layer = ms_newLayerObj($map);
>>$lname="counties";
>>$layer->set(name, $lname);
>>$layer->set(connectiontype, "postgis");
>>$layer->set(connection, "user=root password=c3n5u5 dbname=census
>>host=localhost");
>>$layer->set(data, "the_geom from calhoun_qry1 using srid=-1");
>>$layer->set(type, MS_POLYGON);
>>$layer->set(status, MS_DEFAULT);
>>$class = ms_newClassObj($layer);
>>$class->set(name, "class1");
>>$class->setexpression("[p001001]");
>>$style = ms_newStyleObj($class);
>>$style->color->setRGB(10,100,10);
>>$i= $map->save("c:/inetpub/wwwroot/tmp/Test.map");
>>   if ($i != -1){
>>       $image=$map->draw();
>>       //$map->{imagecolor}= $map->addColor(0,0,255);
>>       $image_url=$image->saveWebImage();
>>  }
>>
>>here is the error messages:
>>Warning: [MapServer Error]: msDrawMap(): Failed to draw layer named
>>'(null)'. in c:\inetpub\wwwroot\mapExamples\map3.php on line 22
>>
>>Warning: [MapServer Error]: msSHPOpenFile(): (c:/ms/map_files/the geom
>>from counties) in c:\inetpub\wwwroot\mapExamples\map3.php on line 22
>>
>>Warning: [MapServer Error]: msSHPOpenFile(): (c:/ms/map_files/the geom
>>from counties) in c:\inetpub\wwwroot\mapExamples\map3.php on line 22
>>
>>Fatal error: Call to a member function on a non-object in
>>c:\inetpub\wwwroot\mapExamples\map3.php on line 24
>>
>>the worning message is not looking relevant c:/ms/map_files/the geom from .....
>>
>>can anybody help me please....
>>
>>
>>--
>>Shashi Kiran Reddy. Gireddy,
>>Graduate Assistant,
>>CBER, University of Alabama.
>>http://www.cs.ua.edu/shashi
>>Home: 205-752-5137 Cell: 205-657-1438
>>
>
>
>
> --
> Shashi Kiran Reddy. Gireddy,
> Graduate Assistant,
> CBER, University of Alabama.
> http://www.cs.ua.edu/shashi
> Home: 205-752-5137 Cell: 205-657-1438
>

--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------



More information about the mapserver-users mailing list