2

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

asked Apr 23, 2012 at 11:00

1 Answer 1

4

I assume this relates to Why does Mapserver throw "msQueryByPoint(): Search returned no results."? ? 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

answered Apr 25, 2012 at 14:09
5
  • 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" Commented Apr 26, 2012 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. Commented Apr 26, 2012 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. Commented Apr 26, 2012 at 7:03
  • You have asked this on a different question Senthil. Do you still get the error for THIS question? Commented Apr 26, 2012 at 8:29
  • I think this thread should be closed.I dont get this error any more . I get a new error now. Commented Apr 26, 2012 at 9:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.