Skip to content

Commit dd89d05

Browse files
committed
test
1 parent cdab94d commit dd89d05

File tree

1 file changed

+173
-0
lines changed

1 file changed

+173
-0
lines changed

test.py

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# from numpy.lib.shape_base import tile
2+
# import labelbox
3+
# from labelbox.data.annotation_types.geometry import point
4+
# from labelbox.data.serialization.labelbox_v1.converter import LBV1Converter, LBV1Label
5+
# from labelbox.data.annotation_types import (LabelList, ImageData, MaskData,
6+
# Rectangle, ObjectAnnotation,
7+
# ClassificationAnnotation, Point,
8+
# ClassificationAnswer, Radio, Mask,
9+
# Label, annotation)
10+
# from labelbox import User, Project
11+
12+
# import json
13+
# from labelbox.data.annotation_types.data.tiled_image import EPSG, EPSGTransformer, TileLayer, TiledBounds, TiledImageData
14+
# from PIL import Image
15+
# from typing import Union
16+
# from enum import Enum
17+
18+
# from labelbox import Client
19+
# from shapely.geometry import Polygon, box
20+
# import cv2
21+
# import numpy as np
22+
23+
# import requests
24+
# import os
25+
26+
# # from labelbox.schema.labelbox_event import LabelboxEvent
27+
28+
# os.system('clear')
29+
30+
# # apikey = os.environ.get('apikey')
31+
# # client = Client(apikey)
32+
33+
# epsg4326 = EPSG.EPSG4326
34+
# epsg3857 = EPSG.EPSG3857
35+
# epsgsimple = EPSG.SIMPLEPIXEL
36+
37+
# # # top_left_bound = Point(x=37.87488726890353, y=-122.32488870620728)
38+
# # top_left_bound = Point(x=-122.32488870620728, y=37.87488726890353)
39+
# # # bottom_right_bound = Point(x=37.87280390440759, y=-122.32154130935669)
40+
# # bottom_right_bound = Point(x=-122.32154130935669, y=37.87280390440759)
41+
42+
# top_left_bound = Point(x=0, y=0)
43+
# bottom_right_bound = Point(x=256, y=256)
44+
45+
# bounds_simple = TiledBounds(epsg=EPSG.SIMPLEPIXEL,
46+
# bounds=[top_left_bound, bottom_right_bound])
47+
48+
# bounds_3857 = TiledBounds(epsg=EPSG.EPSG3857,
49+
# bounds=[
50+
# Point(x=-104.150390625, y=30.789036751261136),
51+
# Point(x=-81.8701171875, y=45.920587344733654)
52+
# ])
53+
# bounds_4326 = TiledBounds(epsg=EPSG.EPSG4326,
54+
# bounds=[
55+
# Point(x=-104.150390625, y=30.789036751261136),
56+
# Point(x=-81.8701171875, y=45.920587344733654)
57+
# ])
58+
59+
# # layer = TileLayer(
60+
# # url="https://labelbox.s3-us-west-2.amazonaws.com/pathology/{z}/{x}/{y}.png",
61+
# # name="slippy map tile")
62+
63+
# # tiled_image_data = TiledImageData(tile_layer=layer,
64+
# # tile_bounds=bounds_simple,
65+
# # zoom_levels=[1, 23],
66+
# # version=2)
67+
# # tiled_image_data.multithread = True
68+
# # # print(tiled_image_data.as_raster_data(zoom=0))
69+
# # image_array = tiled_image_data.as_raster_data(zoom=2)
70+
# # image_array_value = tiled_image_data.value
71+
# # im = Image.fromarray(image_array_value)
72+
# # im.show()
73+
74+
# # #____________________________________________________________________________________________________
75+
# # GEO TO PIXEL
76+
# # print(f"\n")
77+
# # transformer = EPSGTransformer()
78+
# # transformer.geo_and_pixel(src_epsg=epsg3857,
79+
# # pixel_bounds=bounds_simple,
80+
# # geo_bounds=bounds_3857,
81+
# # zoom=0)
82+
# # point_3857 = Point(x=-11016716.012685884, y=5312679.21393289)
83+
# # point_simple = transformer(point=point_3857)
84+
# # print(f"initial 3857 point...{point_3857}")
85+
# # print(f"geo 3857 to pixel...{point_simple}")
86+
87+
# # #____________________________________________________________________________________________________
88+
# # print(f"\n")
89+
# # # PIXEL TO GEO
90+
# # transformer = EPSGTransformer()
91+
# # transformer.geo_and_pixel(src_epsg=epsgsimple,
92+
# # pixel_bounds=bounds_simple,
93+
# # geo_bounds=bounds_3857,
94+
# # zoom=0)
95+
# # # point_simple = Point(x=154, y=130)
96+
# # point_3857 = transformer(point=point_simple)
97+
# # print(f"initial pixel point...{point_simple}")
98+
# # print(f"pixel to geo...{point_3857}")
99+
# # #____________________________________________________________________________________________________
100+
# print(f"\n")
101+
# #GEO TO GEO
102+
# transformer = EPSGTransformer()
103+
# transformer.geo_and_geo(EPSG.EPSG4326, EPSG.EPSG3857)
104+
105+
# point_4326 = Point(x=-98.96484375, y=43.004647127794435)
106+
# point_3857 = transformer(point=point_4326)
107+
# print(f"initial 4326 point...{point_4326}")
108+
# print(f"geo 4326 to geo 3857...{point_3857}")
109+
110+
# # #____________________________________________________________________________________________________
111+
# print(f"\n")
112+
# #GEO TO GEO
113+
# transformer = EPSGTransformer()
114+
# transformer.geo_and_geo(EPSG.EPSG3857, EPSG.EPSG4326)
115+
116+
# # point_3857 = Point(x=1000, y=1000)
117+
# point_4326 = transformer(point=point_3857)
118+
# print(f"initial 3857 point...{point_3857}")
119+
# print(f"geo 3857 to geo 4326...{point_4326}")
120+
121+
# zoom = 4
122+
# #____________________________________________________________________________________________________
123+
# # GEO TO PIXEL
124+
# print(f"\n")
125+
# transformer = EPSGTransformer()
126+
# transformer.geo_and_pixel(src_epsg=epsg4326,
127+
# pixel_bounds=bounds_simple,
128+
# geo_bounds=bounds_4326,
129+
# zoom=zoom)
130+
# point_4326 = Point(x=-98.96484375, y=43.004647127794435)
131+
# point_simple = transformer(point=point_4326)
132+
# print(f"initial 4326 point...{point_4326}")
133+
# print(f"geo 4326 to pixel...{point_simple}")
134+
135+
# #____________________________________________________________________________________________________
136+
# # print(f"\n")
137+
# # # PIXEL TO GEO
138+
# transformer = EPSGTransformer()
139+
# transformer.geo_and_pixel(src_epsg=epsgsimple,
140+
# pixel_bounds=bounds_simple,
141+
# geo_bounds=bounds_4326,
142+
# zoom=zoom)
143+
144+
# point_4326 = transformer(point=point_simple)
145+
# print(f"initial pixel point...{point_simple}")
146+
# print(f"pixel to geo 4326...{point_4326}")
147+
148+
# print(f"\n")
149+
# # PIXEL TO GEO
150+
# transformer = EPSGTransformer()
151+
# transformer.geo_and_pixel(src_epsg=epsgsimple,
152+
# pixel_bounds=bounds_simple,
153+
# geo_bounds=bounds_3857,
154+
# zoom=zoom)
155+
156+
# point_3857 = transformer(point=point_simple)
157+
# print(f"initial pixel point...{point_simple}")
158+
# print(f"pixel to geo 3857...{point_3857}")
159+
160+
# transformer = EPSGTransformer()
161+
# transformer.geo_and_geo(src_epsg=epsg3857, tgt_epsg=epsg4326)
162+
# point_4326 = transformer(point=point_3857)
163+
# print(f"3857 to 4326...{point_4326}")
164+
165+
# #____________________________________________________________________________________________________
166+
# #assumptions:
167+
# #bounds will always be in 4326 as that is what leaflet assumes
168+
169+
170+
def hello_world():
171+
print("hello world")
172+
173+
if 5 == 5: print("goodbye world")

0 commit comments

Comments
 (0)