Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I got a point layer into QGIS from postgresql database. After this I used a plugin to export it to a map file.After exporting the following is the starting of the map file.

 NAME "QGIS-MAP"
 # Map image size
 EXTENT 59.396660 7.316000 105.983338 35.204001
 Imagecolor 255 255 255
 SIZE 100 100
 UNITS meters
 Imagetype jpeg

 FONTSET 'C:\ms4w\Apache\htdocs\fontset.txt'

PROJECTION
'proj=longlat'
'datum=WGS84'
'no_defs'

Now when I change the size parameter to 600 400 and the units to dd. It gives me the following error while rendering the layer.

msDrawMap(): Image handling error. Failed to draw layer named 'growth_1'. msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR: column "%growth_1_id%" does not exist LINE 1: ...ary(ST_Force_2D("the_geom"),'NDR'),'hex') as geom,"%growth_1... ^

First of all I am not sure why is it taking units as meter.But if I dont change it to dd , the legends come up but the layer is not rendered. Also the extent which i get is in the range of 100's and not the one which I have defined.

Could someone tell me where is this thing going wrong.

enter image description here

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I assume this relates to Query in mapserver ? If so and as far as the error you are getting, I suspect its because you have not defined (does not exist?) a pk column in the postgis layer. Your growth_1 layer should include the USING UNIQUE in the DATA keyword e.g.:

CONNECTIONTYPE postgis
CONNECTION "dbname='postgis' host=localhost port=5432 user='postgres' password='xxxxxxx' sslmode=disable"
DATA 'the_geom FROM "growth_1" USING srid=4326  USING unique [your_pk_column]'

I am not sure, but I pressume that if you don't define the unique column mapserver will assume its called [layer_name]_id and this is why you are getting this error.

Also, have a look at the mapserver documentation here and here

share|improve this answer
    
I did try the unique column after I posted the question, but it doesnt seem to help my case: CONNECTION "dbname='postgis' host=localhost port=5432 user='postgres' password='xxxxxxx' sslmode=disable" DATA "the_geom FROM growth_1 USING unique oid USING srid=4326" –  Senthil Apr 26 '12 at 6:00
    
Are you sure OID exists in the table? I think OID is one of Postgis system fields. I would suggest creating a new unique column, call it-say- gid and then define this in the mapfile. i.e. ALTER TABLE xyz > > ADD COLUMN gid serial; I think I remember something about OIDs that are not supposed to be defined as the unique key in the mapfile. –  mapoholic Apr 26 '12 at 6:44
    
I added a column named as oid .Now what happens is I get the query table output with field names but not the values. I shall add the screenshot of the query result. –  Senthil Apr 26 '12 at 7:03
    
You have asked this on a different question Senthil. Do you still get the error for THIS question? –  mapoholic Apr 26 '12 at 8:29
    
I think this thread should be closed.I dont get this error any more . I get a new error now. –  Senthil Apr 26 '12 at 9:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.