[mapserver-users] shapeObj classIndex
Mohamed Meher TOUHAMI
m.touhami at topnet.tn
Mon Jun 23 08:24:06 PDT 2014
Hi Steve,
I am using the java SWIG api.
Layer=new layerObj(map);
layer.setStatus(MapServerConstants.MS_ON);
layer.setType(MS_LAYER_TYPE.MS_LAYER_POLYGON);
layer.setConnectiontype(MS_CONNECTION_TYPE.MS_INLINE);
shapeObj shape = GeometryProxy.createObjGeometry(g.getGeometry());// creating the shapeObj Object
classObj co = SymbolProxy.createFillSymbol(map, g.getSymbol());// creating the classObj Object
shape.setClassindex(layer.insertClass(co, -1));
layer.addFeature(shape);
I found out another method using attributes
Layer=new layerObj(map);
layer.setStatus(MapServerConstants.MS_ON);
layer.setProcessing(“ITEMS=index”);
layer.setClassItem(“index”);
layer.setType(MS_LAYER_TYPE.MS_LAYER_POLYGON);
layer.setConnectiontype(MS_CONNECTION_TYPE.MS_INLINE);
shapeObj shape = GeometryProxy.createObjGeometry(g.getGeometry());// creating the shapeObj Object
classObj co = SymbolProxy.createFillSymbol(map, g.getSymbol());// creating the classObj Object
shape.initValues(1);
index=layer.insertClass(co, -1);
layer.getClass(index).setExpression(Integer.toString(index));
shape.setValue(0, Integer.toString(index) );
layer.addFeature(shape);
I add more data but I do not think performances will much suffer
I wonder if there is a better solution.
Meher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140623/4d11727a/attachment.htm>
More information about the MapServer-users
mailing list