Help Needed in Postgis - Mailing list pgsql-general

From ajay kamath
Subject Help Needed in Postgis
Date
Msg-id 20061029192324.70396.qmail@web31311.mail.mud.yahoo.com
Whole thread Raw
List pgsql-general
Hi,
    I'm new to the mapserver and postgis system. I'm not very familiar with the structure applications involving these. My query is probably a very elementry one . Can someone please help me resolve this.

AIM:
I have a working Mapserver demo application, the common one which displays the map of ITASCA, this uses shape files. I want to display any simple geometry stored in the Postgis databse onto the browser. So i was trying to do this by modifying the demo example.

THE PROCEDURE I FOLLOWED:

1) First created some data in the database. Using the below SQL statements.
CREATE TABLE roads_geom ( ID int4, NAME varchar(25) );

SELECT AddGeometryColumn( 'roads_geom', 'geom', -1, 'LINESTRING', 2);

ALTER TABLE roads_geom ADD CONSTRAINT geometry_valid_check CHECK (isvalid(geom));

INSERT INTO roads_geom (ID, NAME, GEOM) VALUES (1, 'Warren', GeomFromText('LINESTRING( 388907.634400379  5204120.88405952,490896.339019834  5300243.30613897)', -1));

INSERT INTO roads_geom (ID, NAME, GEOM) VALUES (2, 'Summit', GeomFromText('LINESTRING(389107.634400379  5223120.88405952,480800.339019834  5310000.30613897)', -1));

Note: i didnt use shp2sql to enter data in postgis DB. Is directly writing above sql queries wrong ?
      i tried to keep the coordinates of the lines such that they are within the extent mentioned in the mapfile.


2) I changed the .map file.  I removed the demo application layers and added my own layer. Below is the exact mapfile

#
# Start of map file
#
MAP
  NAME ITASCA
  DEBUG ON
  STATUS ON
  SIZE 600 600
  EXTENT 388107.634400379 5203120.88405952 500896.339019834 5310243.30613897
  UNITS METERS
  SHAPEPATH "data"
  IMAGECOLOR 255 255 255
  TEMPLATEPATTERN "itasca"
  IMAGETYPE PNG


  #
  # Start of web interface definition (including WMS enabling metadata)
  #
  WEB
    HEADER templates/header.html
    TEMPLATE "set in index.html"
    FOOTER templates/footer.html    
    MINSCALE 1000
    MAXSCALE 1550000
    IMAGEPATH "set in index.html"
    IMAGEURL "set in index.html"
    METADATA
      WMS_TITLE "UMN MapServer Itasca Demo"
      WMS_ABSTRACT "This is a UMN MapServer application for Itasca County located in north central Minnesota."
      WMS_ACCESSCONSTRAINTS "none"

      # change this value to match your setup
      WMS_ONLINERESOURCE "http://localhost.localdomain/mapserver_demos/itasca/index.html"

      WMS_SRS "EPSG:26915"
    END
  END

  #
  # Start of layer definitions
  #

LAYER
  CONNECTIONTYPE postgis
  NAME "roads"
  # Connect to a remote spatial database
  CONNECTION "user=postgres password=public dbname=postgis host=localhost port=5432"
  # Get the lines from the 'geom' column of the 'roads' table
  DATA "geom FROM roads_geom"
  STATUS ON
  TYPE LINE
    
  CLASS
    COLOR 0 0 0      
  END
 END

END #Map File


QUERIES:
I'm not getting any lines drawn on the browser ouptut.

Am i missing some really important thing to be written other than the mapfile.
I also tried the same with MULTILINE,but same result was obtained.

How do i locate the error. Like for example , is the data getting fetched from the DB or no. I did set the DEBUG ON but no error message on the screen. Also If i mention the wrong table name or column name in the map file. no error is shown anywhere just the browser shows a blank map. I'm not even sure whether it connecting to the db and fetching data. How do i solve this

 Is it enough just to modify the .map file  or some  new  JSP  or other files need
to be written.

Thank you for your time.
Ajay.


Access over 1 million songs - Yahoo! Music Unlimited Try it today.

pgsql-general by date:

Previous
From: Markus Schiltknecht
Date:
Subject: lots of values for IN() clause
Next
From: Thomas Kellerer
Date:
Subject: Re: What is causing 'canceling statement due to user