<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>Necesito crear una capa de tipo shapefile a partir de una tabla de Oracle Spatial.</div><div><br></div><div>Hago lo siguiente:</div><div><br></div><div><p style="margin: 0px;" data-mce-style="margin: 0px;"><span style="font-family: "lucida console", sans-serif; font-size: small;">os = openStore('Oracle',port='1234',</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> URL='jdbc:oracle:thin:@bdoratest.prueba.es:1234:test',</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> CRS='EPSG:25830',</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> PKFields='ID',</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> BaseFilter='',</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> DefaultGeometryField='GEOMETRY',</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> Fields='',</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> Table=nombre_tabla,</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> password='xxx',</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> dbname='test',</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> host='bdoratest.prueba.es',</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> dbuser='prueba',</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> ProviderName='Oracle')</span><br></p><p style="margin: 0px;" data-mce-style="margin: 0px;"><br></p><p style="margin: 0px;" data-mce-style="margin: 0px;"><span style="font-family: "lucida console", sans-serif; font-size: small;">schema = createFeatureType() </span></p><p style="margin: 0px;" data-mce-style="margin: 0px;"><span style="font-family: "lucida console", sans-serif; font-size: small;">schema.append("ID", "INTEGER")</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> schema.append("GEOMETRY", "GEOMETRY")</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> schema.get("GEOMETRY").setGeometryType(tipo_geom, D2)</span><br> <br><span style="font-family: "lucida console", sans-serif; font-size: small;"> layer = createLayer(schema=schema,</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> servertype="FilesystemExplorer",</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> layertype="Shape",</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> shpFile="capa_oracle.shp",</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> CRS="EPSG:25830",</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> geometryType=geom.POLYGON</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> )</span><br> <br><span style="font-family: "lucida console", sans-serif; font-size: small;"> layer.edit()</span></p><p style="margin: 0px;" data-mce-style="margin: 0px;"><br></p><p style="margin: 0px;" data-mce-style="margin: 0px;"><span style="font-family: "lucida console", sans-serif; font-size: small;">features = os.features()</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> for f in features:</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> value_id = f.get('ID)</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> value_geom = f.get('GEOMETRY')</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;"> layer.append(ID=value_id,GEOMETRY=value_geom)</span><br><span style="font-family: "lucida console", sans-serif; font-size: small;">layer.commit()</span></p><p style="margin: 0px;" data-mce-style="margin: 0px;"><br></p><p style="margin: 0px;" data-mce-style="margin: 0px;"><span style="font-family: "lucida console", sans-serif; font-size: small;">currentView().getMapContext().getLayers().removeLayer(nombre_capa)</span></p><p style="margin: 0px;" data-mce-style="margin: 0px;"><span style="font-family: "lucida console", sans-serif; font-size: small;">currentView().addLayer(layer)</span></p><p style="margin: 0px;" data-mce-style="margin: 0px;"><br></p><p style="margin: 0px;" data-mce-style="margin: 0px;">Con tablas pequeña funciona bien, pero con tablas grandes tarda mucho y al final da un error de memoria.</p><p style="margin: 0px;" data-mce-style="margin: 0px;">Hay alguna forma de hacerlo directamente, sin necesidad de recorrer el FeatureSet, con algún comando tipo "Export", similar a lo que se hace desde el entorno de usuario para exportar capas de un tipo a otro.</p><p style="margin: 0px;" data-mce-style="margin: 0px;"><br></p><p style="margin: 0px;" data-mce-style="margin: 0px;">Un saludo.</p><p style="margin: 0px;" data-mce-style="margin: 0px;">Víctor Montes.</p><p style="margin: 0px;" data-mce-style="margin: 0px;"><br></p></div></div></body></html>