blank image

Matthew Perry perrygeo at GMAIL.COM
Sun Sep 9 22:43:42 EDT 2007


Terence,

There are three separate issues:

1. What projection is your output map in? This is the projection of
the overall map, presumably the NZ grid.

2. What projection is your data in? This is the projection assigned to
your layer. If different than #1, it must be assigned and the data
will be reprojected on-the-fly.

3. What is the extent in the output map projection? Use this to set
the map extents. If your output map is in the epsg:27200 projection ,
then your given extents (-180, -90, 180, 90) are not correct. Those
are the geographic coordinates (ie longitudes and latitudes) but you
want to specify the extent in the NZ grid.


- matt

On 9/9/07, Terence Maru <terence at wairoadc.govt.nz> wrote:
>
>
>
> 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] 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/
>
> "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 the content
> has been cleared by MailMarshal ________________________________
>


-- 
Matthew T. Perry
http://www.perrygeo.net

"You never change things by fighting the existing reality.
To change something, build a new model that makes
the existing model obsolete" - R. Buckminster Fuller



More information about the mapserver-users mailing list