Hola a todos Estoy tratando de ejecutar un geoproceso utilizando la clase BufferGeoprocess de gvSIG pero me esta saliendo este error y no se por que:
java.lang.NullPointerException at com.iver.cit.gvsig.fmap.operations.strategies.DefaultStrategy.process(DefaultStrategy.java:393) at com.iver.cit.gvsig.geoprocess.impl.buffer.fmap.BufferGeoprocess.computeOnlyBuffers(BufferGeoprocess.java:360) at com.iver.cit.gvsig.geoprocess.impl.buffer.fmap.BufferGeoprocess.access$8(BufferGeoprocess.java:350) at com.iver.cit.gvsig.geoprocess.impl.buffer.fmap.BufferGeoprocess$1.run(BufferGeoprocess.java:607) at com.iver.cit.gvsig.geoprocess.impl.buffer.fmap.BufferGeoprocess.process(BufferGeoprocess.java:303) Este es mi código, espero puedan ayudarme; y gracias de antemano: com.iver.andami.ui.mdiManager.IWindow view = PluginServices.getMDIManager().getActiveWindow(); if(view instanceof View) { View vista=(View)view; MapControl mapCtrl = vista.getMapControl(); CargadorCapas cargador = new CargadorCapas(); FLyrVect capa = cargador.cargarTabla("a_hidlineal", "Hidrografia", 0, mapCtrl, vista, "jdbc:postgresql://localhost:5432/Baracoa","postgres","postgres"); FLyrVect inputLayer = null; try{ inputLayer = (FLyrVect)capa.cloneLayer(); inputLayer.setName("HidrografiaGEOP"); File outputFile = new File("buffer.shp"); BufferGeoprocess geoprocess = new BufferGeoprocess(inputLayer); HashMap<String, Object> params = new HashMap<String, Object>(); params.put("layer_selection", new Boolean(false)); params.put("dissolve_buffers", new Boolean(false)); params.put("buffer_distance", new Double(1000)); params.put("strategy_flag", new Byte(BufferGeoprocess.ATTRIBUTE_DISTANCE_STRATEGY)); params.put("numRings", new Integer(1)); params.put("typePolBuffer", new Byte(BufferVisitor.BUFFER_OUTSIDE_POLY)); params.put("cap", new Byte(BufferVisitor.CAP_SQUARE)); params.put("projection", capa.getProjection()); params.put("distanceunits", new Integer(100)); params.put("mapunits", new Integer(100)); params.put("attr_name", "cantidadcontaminate"); geoprocess.setParameters(params); SHPLayerDefinition definition = (SHPLayerDefinition) geoprocess.createLayerDefinition(); definition.setFile(outputFile); ShpSchemaManager schemaManager = new ShpSchemaManager(outputFile.getAbsolutePath()); IWriter writer = null; int shapeType = definition.getShapeType(); if(shapeType != XTypes.MULTI){ writer = new ShpWriter(); ((ShpWriter) writer).setFile(definition.getFile()); writer.initialize(definition); } else{ writer = new MultiShpWriter(); ((MultiShpWriter) writer).setFile(definition.getFile()); writer.initialize(definition); } geoprocess.setResultLayerProperties(writer, schemaManager); geoprocess.checkPreconditions(); System.out.println("Inicio geoproceso...."); geoprocess.process(); System.out.println("Fin geoproceso"); }catch (Exception e) { e.printStackTrace(); } //mostramos las capas if (inputLayer!= null) { inputLayer.setVisible(true); vista.getMapControl().getMapContext().beginAtomicEvent(); vista.getMapControl().getMapContext().getLayers().addLayer(inputLayer); vista.getMapControl().getMapContext().endAtomicEvent(); } } else JOptionPane.showMessageDialog(null, "Esto no es una vista"); } Saludos, Raisel -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Error-al-ejecutar-Geoproceso-tp5674608p5674608.html Sent from the gvSIG desarrolladores mailing list archive at Nabble.com. _______________________________________________ gvSIG_desarrolladores mailing list gvSIG_desarrolladores@listserv.gva.es http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores