Exemple #1
0
#shape_path = "/home/boland/Dropbox/University/UniMelb\
#/AGOS/PROGRAMS/ANT/Versions/26.04.2015/shapefiles/aus.shp"

t0 = dt.datetime.now()

#-----------------------------------------------------------------------------
# INITIALISE CLASS STATES
#-----------------------------------------------------------------------------

# Generate InShape class
SHAPE = InShape(shape_path)
# Create shapely polygon from imported shapefile
UNIQUE_SHAPE = SHAPE.shape_poly()
print type(UNIQUE_SHAPE)
# Generate InPoly class
INPOLY = InPoly(shape_path)
GEODESIC = Geodesic()
COORDS = Coordinates()
INPOLY = InPoly(shape_path)
POLY_NODES = INPOLY.poly_nodes()

# decluster the points to desired specifications.
coords = COORDS.decluster(inputs=coords, degree_dist=0.5)

lonmin, lonmax = np.floor(min(coords[:, 0])), np.ceil(max(coords[:, 0]))
latmin, latmax = np.floor(min(coords[:, 1])), np.ceil(max(coords[:, 1]))
print lonmin, lonmax, latmin, latmax

plt.figure()
plt.scatter(coords[:, 0], coords[:, 1])
plt.show()
dataless_path = 'ALL_AUSTRALIA.870093.dataless'

coords = Dataless.locs_from_dataless(dataless_path)

shape_path = "/home/boland/Dropbox/University/UniMelb\
/AGOS/PROGRAMS/ANT/Versions/26.04.2015/shapefiles/aus.shp"

t0 = dt.datetime.now()

# Generate InShape class
SHAPE = InShape(shape_path)
# Create shapely polygon from imported shapefile 
UNIQUE_SHAPE = SHAPE.shape_poly()
print type(UNIQUE_SHAPE)
# Generate InPoly class
INPOLY = InPoly(shape_path)
# Create matplotlib Path object from imported shapefile
outer_shape = UNIQUE_SHAPE.buffer(1.,resolution=1)
inner_shape = UNIQUE_SHAPE.buffer(-8,resolution=1)

outer_poly = INPOLY.poly_from_shape(shape=outer_shape)
inner_poly = INPOLY.poly_from_shape(shape=inner_shape)
many_points = INPOLY.rand_poly(poly=outer_poly, N=1e4)

# Scale smaller shape to fit inside larger shape. 
#SMALL_SHAPE = scale(UNIQUE_SHAPE, xfact=0.3, yfact=0.3)
#points_in_small_shape = INPOLY.rand_shape(shape=SMALL_SHAPE, IN=False)
# Generate matplotlib Path object for the small scalled polygon 
#small_poly = INPOLY.node_poly(SHAPE.external_coords(shape=SMALL_SHAPE))
# Remove points that are outside the buffered_poly
outer_poly_points = INPOLY.points_in(many_points, poly=outer_poly)
Exemple #3
0

t0 = dt.datetime.now()


# -----------------------------------------------------------------------------
# INITIALISE CLASS STATES
# -----------------------------------------------------------------------------

# Generate InShape class
SHAPE = InShape(shape_path)
# Create shapely polygon from imported shapefile
UNIQUE_SHAPE = SHAPE.shape_poly()
print type(UNIQUE_SHAPE)
# Generate InPoly class
INPOLY = InPoly(shape_path)
GEODESIC = Geodesic()
COORDS = Coordinates()
INPOLY = InPoly(shape_path)
POLY_NODES = INPOLY.poly_nodes()


# decluster the points to desired specifications.
coords = COORDS.decluster(inputs=coords, degree_dist=0.5)


lonmin, lonmax = np.floor(min(coords[:, 0])), np.ceil(max(coords[:, 0]))
latmin, latmax = np.floor(min(coords[:, 1])), np.ceil(max(coords[:, 1]))
print lonmin, lonmax, latmin, latmax

dataless_path = 'ALL_AUSTRALIA.870093.dataless'

#coords = Dataless.locs_from_dataless(dataless_path)

shape_path = '/home/iese/10kmR.shp' 


t0 = dt.datetime.now()

# Generate InShape class
SHAPE = InShape(shape_path)
# Create shapely polygon from imported shapefile 
UNIQUE_SHAPE = SHAPE.shape_poly()
#print type(UNIQUE_SHAPE)
# Generate InPoly class
INPOLY = InPoly(shape_path)
# Create matplotlib Path object from imported shapefile
#outer_shape = UNIQUE_SHAPE.buffer(1.,resolution=1)
#inner_shape = UNIQUE_SHAPE.buffer(-8,resolution=1)

#outer_poly = INPOLY.poly_from_shape(shape=outer_shape)
#inner_poly = INPOLY.poly_from_shape(shape=inner_shape)

poly = INPOLY.poly_from_shape(shape=UNIQUE_SHAPE)

many_points = INPOLY.rand_poly(poly=poly, N=1e5)

# Scale smaller shape to fit inside larger shape. 
#SMALL_SHAPE = scale(UNIQUE_SHAPE, xfact=0.3, yfact=0.3)
#points_in_small_shape = INPOLY.rand_shape(shape=SMALL_SHAPE, IN=False)
# Generate matplotlib Path object for the small scalled polygon 
Exemple #5
0
# Enter path to dataless file
dataless_path = 'ALL_AUSTRALIA.870093.dataless'

#coords = Dataless.locs_from_dataless(dataless_path)

shape_path = '/home/iese/10kmR.shp'

t0 = dt.datetime.now()

# Generate InShape class
SHAPE = InShape(shape_path)
# Create shapely polygon from imported shapefile
UNIQUE_SHAPE = SHAPE.shape_poly()
#print type(UNIQUE_SHAPE)
# Generate InPoly class
INPOLY = InPoly(shape_path)
# Create matplotlib Path object from imported shapefile
#outer_shape = UNIQUE_SHAPE.buffer(1.,resolution=1)
#inner_shape = UNIQUE_SHAPE.buffer(-8,resolution=1)

#outer_poly = INPOLY.poly_from_shape(shape=outer_shape)
#inner_poly = INPOLY.poly_from_shape(shape=inner_shape)

poly = INPOLY.poly_from_shape(shape=UNIQUE_SHAPE)

many_points = INPOLY.rand_poly(poly=poly, N=1e5)

# Scale smaller shape to fit inside larger shape.
#SMALL_SHAPE = scale(UNIQUE_SHAPE, xfact=0.3, yfact=0.3)
#points_in_small_shape = INPOLY.rand_shape(shape=SMALL_SHAPE, IN=False)
# Generate matplotlib Path object for the small scalled polygon