laptop and a wrench

不具合

Java Connector adds multiple SPATIALQUERY tags in ArcXML for a dynamic layer if it has a filter.

最後に公開された状態: August 25, 2014 No Product Found
不具合 ID 番号 NIM045565
送信されましたMay 27, 2009
最終更新日April 2, 2025
適用対象No Product Found
見つかったバージョン9.3
プログラム言語Java
修正されたバージョンN/A
ステータスFixed

対処法

Wrote a method 'removeDuplicateQueries2' to remove duplicate spatial query tag in AXLimport com.esri.aims.mtier.io.ConnectionProxy;import com.esri.aims.mtier.model.map.Map;import com.esri.aims.mtier.model.map.layer.FeatureLayer;import com.esri.aims.mtier.model.workspace.Dataset;import com.esri.aims.mtier.model.map.layer.renderer.symbol.*;import com.esri.aims.mtier.model.map.layer.renderer.*;import com.esri.aims.mtier.model.map.layer.query.Filter;import com.esri.aims.mtier.model.workspace.ShapeWorkspace;import java.io.*;public class AddDynamicLayer { public static void main(String args[]){ try { //Create new connection to the server //In this example we are using TCP Scheme ConnectionProxy cp = new ConnectionProxy(); cp.setHost("nputti"); cp.setPort(5300); cp.setConnectionType("TCP"); cp.setService("bound"); //cp.setDisplayMessages(true); //Create a new map object for the above service Map map = new Map(); map.initMap(cp,91,true,true,true,true); map.setHeight(500); map.setWidth(600); map.getLegend().setDisplay(false); map.setScaleSymbols(true); ShapeWorkspace shpw = new ShapeWorkspace(); shpw.setDirectory("C:\\program Files\\arcGIS\\arcims\\samples\\tutorialData\\Downtown"); shpw.setName("workspace1"); map.addWorkspace(shpw); Dataset ds = new Dataset(); ds.setName("parcels"); ds.setWorkspaceName(shpw.getName()); ds.setType(Dataset.POLYGON); //Create new feature layer FeatureLayer flayer = new FeatureLayer("999",null,null); flayer.setDataset(ds); flayer.setName("Parcels"); flayer.setVisible(true); //Create a new filter and specify the spatial query String whereExp = "PARCELS_ID > 17000"; Filter filter = new Filter(); filter.setWhereExpression(whereExp); //Set the filter on the new layer flayer.setFilterObject(filter); SimpleRenderer rnd = new SimpleRenderer(); SimplePolygonSymbol sps = new SimplePolygonSymbol(); sps.setFillColor("200,100,0"); sps.setFillType(sps.CROSS); rnd.setSymbol(sps); flayer.setRenderer(rnd); Dataset ds1 = new Dataset(); ds1.setName("blocks"); ds1.setWorkspaceName(shpw.getName()); ds1.setType(Dataset.POLYGON); //Create new feature layer FeatureLayer flayer1 = new FeatureLayer("888",null,null); flayer1.setDataset(ds1); flayer1.setName("blocks"); flayer1.setVisible(true); String whereExp1 = "BLOCKS_ID > 300"; Filter filter1 = new Filter(); filter1.setWhereExpression(whereExp1); //Set the filter on the new layer flayer1.setFilterObject(filter1); SimpleRenderer rnd1 = new SimpleRenderer(); SimplePolygonSymbol sps1 = new SimplePolygonSymbol(); sps1.setFillColor("200,100,0"); sps1.setFillType(SimplePolygonSymbol.BDIAGONAL); rnd1.setSymbol(sps1); flayer1.setRenderer(rnd1); //add the new layer to the map layer collection map.getLayers().add(flayer); map.getLayers().add(flayer1); System.out.println("ArcXML : "+map.getArcXML()); String[] dynLayers = {"999","888"}; String zz = removeDuplicateQueries2(map.getArcXML(),dynLayers); // Add this line to send GET_IMAGE request rather than GET_FEATURE map.sendArcXML(zz, Map.GET_IMAGE); String mapURL = map.getMapOutput().getURL(); System.out.println(mapURL); } catch (Exception e) { System.out.println(e.getMessage()); } } public static String removeDuplicateQueries2(String axl, String[] dynamiclayerids) throws Exception { String _axl = ""; String tempLyrID = ""; String dynamiclayerid =""; javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory.newInstance(); javax.xml.parsers.DocumentBuilder db = factory.newDocumentBuilder(); org.xml.sax.InputSource inStream = new org.xml.sax.InputSource(); inStream.setCharacterStream(new java.io.StringReader(axl)); org.w3c.dom.Document doc = db.parse(inStream); org.w3c.dom.NodeList nodeList = doc.getElementsByTagName("SPATIALQUERY"); for(int index=0; index < nodeList.getLength(); index++) { System.out.println(index); org.w3c.dom.Node node = nodeList.item(index); org.w3c.dom.Node parentNode = node.getParentNode(); System.out.println("parentNode "+parentNode.getNodeName()); if (parentNode.getNodeName().equals("LAYERDEF")){ tempLyrID = ((org.w3c.dom.Element)parentNode).getAttribute("id"); System.out.println("tempLyrID "+tempLyrID); for(int id=0;id<dynamiclayerids.length;id++){ dynamiclayerid = dynamiclayerids[id]; if (tempLyrID.equals(dynamiclayerid)){ System.out.println("Removing"); parentNode.removeChild(node); System.out.println("Removed"); doc.normalize(); index--; } }//for }//if System.out.println("last "+nodeList.getLength()); }//for javax.xml.transform.Source source = new javax.xml.transform.dom.DOMSource(doc); StringWriter stringWriter = new StringWriter(); javax.xml.transform.Result result = new javax.xml.transform.stream.StreamResult(stringWriter); javax.xml.transform.TransformerFactory tFactory = javax.xml.transform.TransformerFactory.newInstance(); javax.xml.transform.Transformer transformer = tFactory.newTransformer(); transformer.transform(source, result); _axl = stringWriter.getBuffer().toString(); System.out.println(_axl); return _axl ; }}

再現の手順

不具合 ID: NIM045565

ソフトウェア:

  • No Product Found

バグのステータスが変更されたときに通知を受け取る

Esri Support アプリのダウンロード

このトピックについてさらに調べる

ArcGIS エキスパートのサポートを受ける

テクニカル サポートへのお問い合わせ

Esri Support アプリのダウンロード

ダウンロード オプションに移動