@@ -80,47 +80,45 @@ def get_world_box(ts):
80
80
polyq = get_world_box (qts )
81
81
polyp = get_world_box (pts )
82
82
83
-
84
83
poly_int = polyp .intersection (polyq )
85
84
poly_int = poly_int .buffer (- 10 )
85
+ if not poly_int .is_empty :
86
+ minx ,miny ,maxx ,maxy = poly_int .bounds
87
+ xx ,yy = np .meshgrid (np .arange (minx ,maxx ,delta ),np .arange (miny ,maxy ,delta ))
88
+ xx = xx .ravel ()
89
+ yy = yy .ravel ()
90
+ isin = np .zeros (len (xx ),np .bool )
91
+ for i ,xytuple in enumerate (zip (xx ,yy )):
92
+ x ,y = xytuple
93
+ p = shapely .geometry .Point (x ,y )
94
+ if poly_int .contains (p ):
95
+ isin [i ]= True
96
+ else :
97
+ isin [i ]= False
98
+ xx = xx [isin ]
99
+ yy = yy [isin ]
100
+ #print 'step2', time.time()-now
101
+ #now = time.time()
102
+ xy = np .stack ([xx ,yy ]).T
103
+ if xy .shape [0 ]> 0 :
104
+ int_local_q = renderapi .coordinate .world_to_local_coordinates_array (stack ,xy ,qts .tileId ,qts .z ,render = r )
105
+ int_local_p = renderapi .coordinate .world_to_local_coordinates_array (stack ,xy ,pts .tileId ,pts .z ,render = r )
106
+
107
+ newpair = {}
108
+ newpair ['pId' ]= pid
109
+ newpair ['qId' ]= qid
110
+ newpair ['pGroupId' ]= pair ['p' ]['groupId' ]
111
+ newpair ['qGroupId' ]= pair ['q' ]['groupId' ]
112
+ newpair ['matches' ]= {}
113
+ newpair ['matches' ]['p' ]= [int_local_p [:,0 ].tolist (),int_local_p [:,1 ].tolist ()]
114
+ newpair ['matches' ]['q' ]= [int_local_q [:,0 ].tolist (),int_local_q [:,1 ].tolist ()]
115
+ newpair ['matches' ]['w' ]= np .ones (len (xx )).tolist ()
116
+ pairs .append (newpair )
117
+
86
118
87
- minx ,miny ,maxx ,maxy = poly_int .bounds
88
- xx ,yy = np .meshgrid (np .arange (minx ,maxx ,delta ),np .arange (miny ,maxy ,delta ))
89
- xx = xx .ravel ()
90
- yy = yy .ravel ()
91
- isin = np .zeros (len (xx ),np .bool )
92
- for i ,xytuple in enumerate (zip (xx ,yy )):
93
- x ,y = xytuple
94
- p = shapely .geometry .Point (x ,y )
95
- if poly_int .contains (p ):
96
- isin [i ]= True
97
- else :
98
- isin [i ]= False
99
- xx = xx [isin ]
100
- yy = yy [isin ]
101
- #print 'step2', time.time()-now
102
- #now = time.time()
103
- xy = np .stack ([xx ,yy ]).T
104
-
105
- if xy .shape [0 ]> 0 :
106
- int_local_q = renderapi .coordinate .world_to_local_coordinates_array (stack ,xy ,qts .tileId ,qts .z ,render = r )
107
- int_local_p = renderapi .coordinate .world_to_local_coordinates_array (stack ,xy ,pts .tileId ,pts .z ,render = r )
108
-
109
- newpair = {}
110
- newpair ['pId' ]= pid
111
- newpair ['qId' ]= qid
112
- newpair ['pGroupId' ]= pair ['p' ]['groupId' ]
113
- newpair ['qGroupId' ]= pair ['q' ]['groupId' ]
114
- newpair ['matches' ]= {}
115
- newpair ['matches' ]['p' ]= [int_local_p [:,0 ].tolist (),int_local_p [:,1 ].tolist ()]
116
- newpair ['matches' ]['q' ]= [int_local_q [:,0 ].tolist (),int_local_q [:,1 ].tolist ()]
117
- newpair ['matches' ]['w' ]= np .ones (len (xx )).tolist ()
118
- pairs .append (newpair )
119
-
120
-
121
119
resp = r .run (renderapi .pointmatch .import_matches ,matchcollection ,json .dumps (pairs ))
122
120
print "Putting %d pairs in %s" % (len (pairs ),matchcollection )
123
-
121
+
124
122
125
123
class CreateMontagePointMatch (RenderModule ):
126
124
def __init__ (self ,schema_type = None ,* args ,** kwargs ):
@@ -153,7 +151,8 @@ def run(self):
153
151
# make_tile_part(z)
154
152
155
153
156
-
154
+ print "Done with tile pairs, now creating matches!"
155
+ print tile_pair_jsons
157
156
158
157
myp = partial (process_tile_pair_json_file ,
159
158
self .render ,
0 commit comments