You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public.ST_LineInterpolatePoint(public.ST_LineMerge(r.geom), random()) AS geom
229
229
FROM selected_roads a
@@ -235,13 +235,13 @@ END
235
235
$$
236
236
;
237
237
238
-
COMMENT ON PROCEDURE geo_faker.point_in_place_landuse IS 'Uses osm.landuse_polygon and osm.road_line to simulate probable locations for commercial store locations. Can be customized for custom landuse types by manually defining landuse_osm_types temp table.'
238
+
COMMENT ON PROCEDURE geofaker.point_in_place_landuse IS 'Uses osm.landuse_polygon and osm.road_line to simulate probable locations for commercial store locations. Can be customized for custom landuse types by manually defining landuse_osm_types temp table.'
RAISE NOTICE 'Stores to process: %', stores_to_process;
311
+
SELECTCOUNT(*) INTO stores_to_process
312
+
FROM faker_store_location
313
+
;
314
+
RAISE NOTICE 'Generating customers for % stores...', stores_to_process;
311
315
312
-
DROPTABLE IF EXISTS faker_customer_location;
313
-
CREATE TEMP TABLE faker_customer_location
314
-
(
315
-
id BIGINTNOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
316
-
store_id BIGINTNOT NULL,
317
-
customer_id BIGINTNOT NULL,
318
-
geom GEOMETRY(POINT, 3857) NOT NULL
319
-
);
316
+
DROPTABLE IF EXISTS faker_customer_location;
317
+
CREATE TEMP TABLE faker_customer_location
318
+
(
319
+
id BIGINTNOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
320
+
store_id BIGINTNOT NULL,
321
+
customer_id BIGINTNOT NULL,
322
+
geom GEOMETRY(POINT, 3857) NOT NULL
323
+
);
320
324
321
325
322
326
FOR t_row INSELECT*FROM faker_store_location LOOP
323
-
RAISE NOTICE 'Store ID: %', t_row.id;
327
+
IF t_row.store_id % 10=0 THEN
328
+
RAISE NOTICE 'Store ID: %', t_row.store_id;
329
+
END IF;
324
330
325
331
DROPTABLE IF EXISTS place_buffer;
326
332
CREATE TEMP TABLE place_buffer AS
327
-
SELECTid ASstore_id, geom, ST_Buffer(geom, 5000) AS geom_buffer
333
+
SELECT store_id, geom, ST_Buffer(geom, 5000) AS geom_buffer
328
334
FROM faker_store_location
329
-
WHEREid=t_row.id
335
+
WHEREstore_id=t_row.store_id
330
336
;
331
337
332
338
DROPTABLE IF EXISTS store_potential_customers;
333
339
CREATE TEMP TABLE store_potential_customers AS
334
340
SELECT store_id,
335
-
geo_faker.n_points_in_polygon(geom_buffer, 1000)
341
+
geofaker.n_points_in_polygon(geom_buffer, 1000)
336
342
AS geom
337
343
FROM place_buffer
338
344
;
@@ -374,7 +380,7 @@ END;
374
380
$$;
375
381
376
382
377
-
COMMENT ON PROCEDURE geo_faker.points_around_point IS 'Creates fake customer locations around a store. Locations are snapped to roads. Locations not scoped to landuse at this time. Requires faker_store_location temp table with fake store data.';
383
+
COMMENT ON PROCEDURE geofaker.points_around_point IS 'Creates fake customer locations around a store. Locations are snapped to roads. Locations not scoped to landuse at this time. Requires faker_store_location temp table with fake store data.';
0 commit comments