blank image

Terence Maru terence at WAIROADC.GOVT.NZ
Sun Sep 9 19:55:34 EDT 2007


Hi all, I have added a projection to the map object (see attached php
script).  I have also attached the postgis table describe.  The postgis
describe shows that the table "parcels" has a constraint check on
the_geom (column) that the srid is 27200 (NZ Mapping Grid).  Does this
mean that the database has the correct projection?  I have added in the
mapscript the line "$map->setProjection('init=epsg:27200');", my
understanding is that this sets the correct projection for the map
object?  Do I need to set the projection for the layer object too?  Im
still getting a blank image.  I thought it might have something to do
with the extents if my projections are correct?  Still reasearching
though.  Thanks in advance. 

<postgis-start>
Indexes:
    "parcels_pkey" PRIMARY KEY, btree (gid)
    "gist_index" gist (the_geom)
Check constraints:
    "enforce_dims_the_geom" CHECK (ndims(the_geom) = 2)
    "enforce_geotype_the_geom" CHECK (geometrytype(the_geom) =
'MULTIPOLYGON'::text OR the_geom IS NULL)
    "enforce_srid_the_geom" CHECK (srid(the_geom) = 27200)
</postgis-end>

<php_mapscript-start>
$map = ms_newMapObj("");
//$map->set("debug", MS_TRUE);
$map->setSize(600, 300);
$map->setExtent(-180, -90, 180, 90);
 
//define path where to creat image
$map->web->set("imagepath", "./data/");
$map->web->set("imageurl", "./data/");
$map->web->set("log", "./data/logfile.txt");
$map->setProjection('init=epsg:27200');
 
//crate parcel layer, associate it withthe map
$parcelLayer = ms_newLayerObj($map);
$parcelLayer->set("connectiontype", MS_POSTGIS);
$parcelLayer->set("name", "parcels layer");
 
$connector = "user=user dbname=dbname host=localhost";
$parcelLayer->set("connection", $connector);
 
$sql = "the_geom from parcels";
$parcelLayer->set("data", $sql);
 
$parcelLayer->set("status", MS_DEFAULT);
$parcelLayer->set("type", MS_LAYER_POLYGON);
//$parcelLayer->set("debug", MS_ON);
 
$parcelClass = ms_newClassObj($parcelLayer);
$parcelClass->set("name", "parcels class");
 
$parcelStyle = ms_newStyleObj($parcelClass);
$parcelStyle->color->setRGB( 250, 0, 0);
$parcelStyle->outlinecolor->setRGB( 255, 255, 255);
//$parcelStyle->set("symbol", 7);
$parcelStyle->set("symbolname", "circle");
//$parcelStyle->set("size", 6);
$parcelStyle->set("size", 10);
</php_mapscript-end>
 
bm
 


-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU
<mailto:MAPSERVER-USERS at LISTS.UMN.EDU> ] On Behalf Of Gregor Mosheh
Sent: Wednesday, 5 September 2007 12:02 p.m.
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] blank image

Terence Maru wrote:
> Hi everyone, I have a problem generating an image from my postgis
> database  I have attached my php script.  No errors are returned when
> the script is run, just a blank image is returned.  Can anyone see
> whats wrong with my script?  Cheers

This exact same question came up two days ago. 90% of the time, the
issue is projections. Ensure that all layers and the output map are in
the same projection, or else set projection blocks. 90% of the time,
that fixes it.


--
Gregor Mosheh / Greg Allensworth
System Administrator, HostGIS cartographic development & hosting
services http://www.HostGIS.com/ <http://www.HostGIS.com/> 

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA



#####################################################################################
This e-mail message has been scanned for Viruses by McAfee and content has
been cleared by MailMarshal
#####################################################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070910/99b85cc7/attachment.html


More information about the mapserver-users mailing list