Created
August 26, 2011 00:36
-
-
Save mexitek/1172401 to your computer and use it in GitHub Desktop.
Postgre Function that fills in a table calls points with random Lat/Long for location field and a unique name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
amount ALIAS FOR $1; | |
r_lat FLOAT; | |
r_lon FLOAT; | |
BEGIN | |
FOR v_Count IN 1..amount LOOP | |
r_lat := random()*360; | |
r_lon := random()*360; | |
INSERT INTO points (name_of_place,location) VALUES ( 'place_'||v_Count, makepoint( r_lat, r_lon) ); | |
END LOOP; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment