[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    [postgis-users] Postgis, PhP and mapserver
From:       Tien Nguyen <sufibaba () yahoo ! com>
Date:       2002-11-26 15:56:22
Message-ID: 20021126155622.54935.qmail () web14002 ! mail ! yahoo ! com
[Download RAW message or body]

Note: forwarded message attached.


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Received: from [61.94.239.186] by web14006.mail.yahoo.com via HTTP;
	Tue, 26 Nov 2002 07:43:13 PST
Date: Tue, 26 Nov 2002 07:43:13 -0800 (PST)
From: Tien Nguyen <sufibaba@yahoo.com>
Subject: Postgis, PhP and mapserver
To: postgis@yahoogroups.com
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Length: 1498

Hello all,

My configuration is cygwin Postgres 7.2.3-2, Postgis
0.7.3, Mapserver 3.6.3, IIS, all running on XP.

I've just set all of this up 1 week ago. 

The Situation: I've set up the following files.

---------------------------------------------
Displaymap.php
----------------------------------------------
<?php
		$map_path= "d:/MapServerDemo/itasca/php/";
		$map_filename= "s1ex1test.map";
	
		$map_file= $map_path . $map_filename;
		echo "$map_file";
		
		$map = ms_newMapObj("$map_file");
		echo "$map";
		$image=$map->draw();
		$image_url=$image->saveWebImage(MS_PNG,1,1,0);	
		?>
	
		<HTML>
		<HEAD>
		 	<TITLE>Example 1 Displaying a map</TITLE>
		</HEAD>
		<BODY>
		 	<IMG SRC=<?php echo "$image_url"; ?> >
		</BODY>
		</HTML>

-----------------------------------------------

The map file is:
s1ex1.map

------------------------------------------------
NAME S1EX1
	EXTENT -97.238976 41.619778 -82.122902 49.38562
	SIZE 400 300
	SHAPEPATH "D:/MapServerDemo/itasca/php/data/"		
	WEB
		IMAGEPATH "D:/MapServerDemo/itasca/php/tmp/"
		IMAGEURL "http://localhost/mapserver/php/tmp/"
	END

	LAYER # States
	NAME "states"
	DATA states_ugl
	STATUS DEFAULT
	TYPE POLYGON
	CLASSITEM "STATE"
		CLASS
			NAME "Michigan"
			COLOR 255 255 128
			OUTLINECOLOR 0 0 0
		END # end of class object
	END # end of layer object
END # end of map file

---------------------------------------------------

The above map file uses a shape file and it works
fine.

However the problem is when I changed the datasource
of the map file from above to postgres. I used
shp2pgsql to convert the shape into posgres. 

The error message I got was:

"msPOSTGISLayerOpen(): Query error.
msPOSTGISLayerOpen called but unimplemented!"

---------------------------------------------------

NAME S1EX1
EXTENT -97.238976 41.619778 -82.122902 49.38562
SIZE 400 300

	WEB
		IMAGEPATH "D:/MapServerDemo/itasca/php/tmp/"
		IMAGEURL "http://localhost/mapserver/php/tmp/"
	END
	
LAYER # States
 NAME "states"
  CONNECTIONTYPE postgis
  CONNECTION "user=postgres dbname=myGISdb
host=localhost" 
  #NOTE host=localhost assumes that your MapServer
  #  application is running on the same machine
  #  as your PostgreSQL installation

  DATA "the_geom from states_ugl"
  STATUS DEFAULT
  TYPE POLYGON
  CLASSITEM "STATE"
  CLASS
    NAME "Michigan"
    COLOR 255 255 128
    OUTLINECOLOR 0 0 0
  END # end of class object
END # end of layer object
END # end of map file

----------------------------------------------------

However, the new map file works fine with the
following html file.

Testfile.html
-------------------------------

<html>
<body>

src="http://localhost/Scripts/mapserv.exe?map=E:/terrasipProjects/tutorial35/s1/s1ex1.map&mode=map">
		
</body>
</html>

-----------------------------------------

It seems that Mapserver is able to connect the postgis
datasource without a problem.  However, when I tried
to use PHP mapscript to acess postgis via mapserver
map file, it couldn't see the source.

Since there are so many people on this forum that is
so much more knowledgeable than myself, perhaps
someone might be able to give me a hand with this
problem.

Many thanks in advance !

Cheers. Tien :)










__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic