[mapserver-users] creating dynamic layer with mapscript fails
Ahmet Temiz
ahmettemiz88 at gmail.com
Mon Nov 9 01:45:20 PST 2015
hi,
I am struggling with creating dynamic layer with mapscript - java. But
following code
fails as " msPostGISLayerWhichShapes(): Query error ..."
here is the relevant code:
( I am not sure which one is better to use "where clause " rather than
setFilter to query. )
if ( ! items[i].contains("undefined")) {
String f = "yas=" + "'" + yas[jeoId] + "'";
System.out.println("*** f *** "+f); // *** f
>>> " yas='Eosen' "
layerObj jeoLayer = new layerObj(map_yasSec3857);
jeoLayer.setType(MS_LAYER_TYPE.MS_LAYER_POLYGON);
jeoLayer.setName(items[i]);
jeoLayer.setProjection("init=epsg:3857");
jeoLayer.setStatus(mapscript.MS_ON);
jeoLayer.setConnectiontype(MS_CONNECTION_TYPE.MS_POSTGIS);
jeoLayer.setConnection("dbname='tr22' host='localhost' port='5432'
user='or****' password='******'");
jeoLayer.setData("geom from (select gid,yas,geom "
+" from sjeo_yas3857 where "
+ f
+" ) as foo using unique gid using srid=3857");
jeoLayer.setProcessing("CLOSE_CONNECTION=DEFER");
System.out.println( " jeoLayer.getData "+ jeoLayer.getData());
( it gives: >>> geom from (select gid,yas,geom from sjeo_yas3857 where
yas='Eosen' ) as foo using unique gid using srid=3857 I checked it in
console and works)
classObj cl = new classObj(jeoLayer);
styleObj style = new styleObj(cl);
style.setSymbol(1);
style.setColor( new colorObj(255,0,0,255) );
jeoLayer.setStatus(1);
imageObj img = map_yasSec3857.draw();
jeoLayer.close();
img.save("/usr/local/map_yas.png",map_yasSec3857);
img.delete();
bytes=img.getBytes();
}
Can you say what the possible problem is ?
kind regards
--
Ahmet Temiz
Jeoloji Müh.
Afet ve Acil Durum Yönetimi Başkanlığı
Bilgi İşlem Dairesi Başkanlığı-CBS Grubu
________________________
Ahmet Temiz
Geological Eng.
Information Systems - GIS Group
Disaster and Emergency Management
of Presidency
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20151109/9dd5ccf2/attachment.htm>
More information about the MapServer-users
mailing list