Created
September 26, 2014 18:35
-
-
Save jczaplew/796dbf11a69385959eeb to your computer and use it in GitHub Desktop.
Sampling Problem
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
CREATE TABLE line_sample_test AS SELECT 1 AS id, ST_GeomFromGeoJSON('{ "type": "Polygon", "coordinates": [ [ [ -58.614142829001025, -64.152467130133232 ], [ -65.508424852140479, -67.581610209268831 ], [ -61.963369920485604, -74.439847920884802 ], [ -77.925858120419377, -78.378418884442254 ], [ -63.256030036050873, -81.748756605962484 ], [ -28.549802212018704, -80.337938327962092 ], [ -28.88277930349139, -76.673665059565636 ], [ -7.416621873392444, -71.696501159806132 ], [ 9.525134718472202, -70.011332702768129 ], [ 27.093726434037251, -70.462054545217882 ], [ 52.614132521378934, -66.053176371372132 ], [ 68.890038283162795, -67.934301859660906 ], [ 87.477017449903798, -66.876175232052503 ], [ 113.604673293107368, -65.876804707959906 ], [ 120.870999790532181, -67.18969614676729 ], [ 135.873804966373399, -66.033591003533502 ], [ 154.284567498999166, -68.561292012658186 ], [ 171.206790399457446, -71.696501159806132 ], [ 166.094802687848443, -74.381040140936705 ], [ 159.78821089094825, -80.945394789553049 ], [ 180.000000000000142, -84.71338 ], [ 180.000000000000142, -90.0 ], [ -180.0, -90.0 ], [ -180.0, -84.71338 ], [ -179.942499356179042, -84.721443373552489 ], [ -153.586201138300197, -83.68868987419944 ], [ -151.333780483994303, -77.3987370810529 ], [ -135.214582695691291, -74.302698669582242 ], [ -116.216311611783496, -74.243890889634031 ], [ -100.645530768622308, -75.302017517242433 ], [ -88.423951178729624, -73.009392598613502 ], [ -68.935915900331338, -73.009392598613502 ], [ -67.741182623959247, -67.326845398069949 ], [ -58.614142829001025, -64.152467130133232 ] ] ] }') as geom; | |
SELECT UpdateGeometrySRID('public', 'line_sample_test', 'geom', 4326); | |
CREATE TABLE atest AS WITH line AS | |
(SELECT | |
id, | |
ST_ExteriorRing((ST_Dump(geom)).geom) AS geom | |
FROM line_sample_test), | |
linemeasure AS | |
(SELECT | |
ST_AddMeasure(line.geom, 0, (ST_Length(line.geom))::int) AS linem, | |
generate_series(0, (ST_Length(line.geom))::int, 10) AS i | |
FROM line), | |
geometries AS ( | |
SELECT | |
i, | |
ST_LocateAlong(linem, i) AS geom | |
FROM linemeasure) | |
SELECT | |
* from geometries; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment