Ejemplo n.º 1
0
 def writer(self, reader, fname, format):
     """Write a file using geopandas writer."""
     writer = GeopandasWriter()
     writer.file_name = fname
     writer.format = format
     writer.set_input(port=reader.get_output())
     return writer
Ejemplo n.º 2
0
    def _convertShapefileToGeoJson(self, item, tmpdir):
        # TODO need to figure out convention here
        # assumes a shapefile is stored as a single item with a certain name
        # and all of the shapefiles as files within that item with
        # the same name.
        #
        # ex: item['name'] = myshapefile
        #     # abuse of notation for item.files
        #     item.files[0]['name'] =  myshapefile.cpg
        #     item.files[1]['name'] =  myshapefile.dbf
        #     item.files[2]['name'] =  myshapefile.prj
        #     item.files[3]['name'] =  myshapefile.shp
        #     item.files[4]['name'] =  myshapefile.shx

        from gaia.pandas import GeopandasReader, GeopandasWriter
        reader = GeopandasReader()
        reader.file_name = os.path.join(tmpdir, item['name'])
        geojsonFilepath = os.path.join(tmpdir, item['name'] +
                                       PluginSettings.GEOJSON_EXTENSION)
        writer = GeopandasWriter()
        writer.file_name = geojsonFilepath
        writer.format = 'GeoJSON'
        writer.set_input(port=reader.get_output())
        writer.run()
        return geojsonFilepath
Ejemplo n.º 3
0
    def _convertToGeoJson(self, item, tmpdir):
        from gaia.pandas import GeopandasReader, GeopandasWriter

        reader = GeopandasReader()
        reader.file_name = os.path.join(tmpdir, item["name"])
        geojsonFile = os.path.join(tmpdir, item["name"] + PluginSettings.GEOJSON_EXTENSION)
        writer = GeopandasWriter()
        writer.file_name = geojsonFile
        writer.format = "GeoJSON"
        writer.set_input(port=reader.get_output())
        writer.run()
        return geojsonFile