示例#1
0
def shpToWKT(shp_path):
    r = shapefile.Reader(shp_path)  #shp파일 경로
    g = []
    for s in r.shapes():
        g.append(pygeoif.geometry.as_shape(s))
    m = pygeoif.MultiPoint(g)
    return str(m.wkt).replace("MULTIPOINT", "POLYGON(") + ")"
示例#2
0
def shpToWKT(in_shp, reproj=True):
    r = shapefile.Reader(in_shp)
    g = []
    for s in r.shapes():
        g.append(pygeoif.geometry.as_shape(s))
    m = pygeoif.MultiPoint(g)
    return m.wkt
示例#3
0
def procesoShapefile(path_to_shapefile):
    r = shapefile.Reader(path_to_shapefile)
    g = []
    for s in r.shapes():
        g.append(pygeoif.geometry.as_shape(s))
        m = pygeoif.MultiPoint(g)
        global wkt
    return str(m.wkt).replace("MULTIPOINT", "POLYGON(") + ")"
def preprocesado():
    ##Aplicar correccion orbital
    global product
    global product_calibrated
    global HashMap
    print(product)
    parameters = HashMap()
    GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis()
    parameters.put('orbitType', 'Sentinel Precise (Auto Download)')
    parameters.put('polyDegree', '3')
    parameters.put('continueOnFail', 'false')
    apply_orbit_file = GPF.createProduct('Apply-Orbit-File', parameters,
                                         product)

    ##Recortar la imagen
    r = shapefile.Reader(archivo_shape)
    g = []
    for s in r.shapes():
        g.append(pygeoif.geometry.as_shape(s))
    m = pygeoif.MultiPoint(g)
    wkt = str(m.wkt).replace("MULTIPOINT", "POLYGON(") + ")"

    #Usar el shapefile para cortar la imagen
    SubsetOp = snappy.jpy.get_type('org.esa.snap.core.gpf.common.SubsetOp')
    bounding_wkt = wkt
    geometry = WKTReader().read(bounding_wkt)
    HashMap = snappy.jpy.get_type('java.util.HashMap')
    GPF.getDefaultInstance().getOperatorSpiRegistry().loadOperatorSpis()
    parameters = HashMap()
    parameters.put('copyMetadata', True)
    parameters.put('geoRegion', geometry)
    product_subset = snappy.GPF.createProduct('Subset', parameters,
                                              apply_orbit_file)

    #Mostrar las dimensiones de la imagen
    width = product_subset.getSceneRasterWidth()
    print("Width: {} px".format(width))
    height = product_subset.getSceneRasterHeight()
    print("Height: {} px".format(height))
    band_names = product_subset.getBandNames()
    print("Band names: {}".format(", ".join(band_names)))
    band = product_subset.getBand(band_names[0])
    print(band.getRasterSize())
    #plotBand(product_subset, "Intensity_VV", 0, 100000)

    ##Aplicar la calibracion de la imagen
    parameters = HashMap()
    parameters.put('outputSigmaBand', True)
    parameters.put('sourceBands', 'Intensity_VV')
    parameters.put('selectedPolarisations', "VV")
    parameters.put('outputImageScaleInDb', False)
    product_calibrated = GPF.createProduct("Calibration", parameters,
                                           product_subset)
    #plotBand(product_calibrated, "Sigma0_VV", 0, 1)
    print("PREPROCESAMIENTO HECHO EXITOSAMENTE")
示例#5
0
from snappy import HashMap
from snappy import jpy
from snappy import WKTReader
import shapefile
import pygeoif

shp_file_path = "E:\Sentinel 1 SAR Processing\Sentinel_Mosaic\Data\Spatial Data\NPL_adm0.shp"
shp_file = shapefile.Reader(shp_file_path)

g = []

for s in shp_file.shapes():
    g.append(pygeoif.geometry.as_shape(s))

m = pygeoif.MultiPoint(g)

wkt = str(m.wkt).replace("MULTIPOINT", "POLYGON(") + ")"

geometry = WKTReader().read(wkt)

SRTM1SEC = "SRTM 1Sec HGT"

UTM_WGS84 = "GEOGCS[\"WGS84(DD)\",DATUM[\"WGS84\",SPHEROID[\"WGS84\", 6378137.0, 298.257223563]]," \
            "PRIMEM[\"Greenwich\", 0.0],UNIT[\"degree\", 0.017453292519943295],AXIS[\"Geodetic longitude\", EAST]," \
            "AXIS[\"Geodetic latitude\", NORTH]] "


def TOPSAR_Split_config(subswath, firstBurstIndex, lastBurstIndex,
                        polarizations):
    """