postgis 建表插入数据sql

CREATE TABLE lgdtemp(
   ID  SERIAL PRIMARY KEY,
   state  INT  NOT NULL,
   geom geometry(Polygon,4326)
); 


INSERT INTO lgdtemp
VALUES (0,st_geomfromText('POLYGON((122.10243474277 37.586913554557,122.10397969516 37.587385623344,122.10500966342 37.587385623344,122.10496674808 37.587771861442,122.10470925601 37.58785769213,122.10552464755 37.588329760917,122.10827122959 37.588286845573,122.1081853989 37.588544337638,122.1088720444 37.588715999015,122.10947285922 37.588587252982,122.10938702854 37.587213961967,122.11144696506 37.587128131278,122.11123238834 37.588887660392,122.11106072696 37.589188067802,122.11161862644 37.589445559867,122.11161862644 37.590132205375,122.11123238834 37.590518443473,122.11157571109 37.59069010485,122.11127530368 37.591162173637,122.11157571109 37.591376750358,122.11629639896 37.591376750358,122.11659680637 37.591033427604,122.11638222965 37.590561358817,122.11676846774 37.590475528129,122.11629639896 37.589230983146,122.11676846774 37.58927389849,122.1163393143 37.587128131278,122.1163393143 37.58704230059,122.11891423496 37.58704230059,122.11869965824 37.588544337638,122.11951504978 37.588587252982,122.11985837253 37.588329760917,122.11985837253 37.588201014884,122.12260495456 37.588201014884,122.12320576938 37.587900607474,122.123034108 37.58704230059,122.12427865299 37.587171046622,122.12573777469 37.586613147147,122.12582360538 37.586527316459,122.12522279056 37.584553210624,122.12487946781 37.584553210624,122.11586724552 37.584767787345,122.11616765293 37.583651988395,122.11123238834 37.583823649772,122.11170445712 37.584767787345,122.10625420841 37.584896533378,122.10569630893 37.584681956657,122.10307847293      37.584639041312,122.10303555759 37.584681956657,122.10243474277 37.586913554557))', 4326));

INSERT INTO lgdtemp(state , geom)
VALUES(2,st_geomfromText('POLYGON((122.10243474277 37.586913554557,122.10397969516 37.587385623344,
122.10500966342 37.587385623344,122.10496674808 37.587771861442,122.10470925601 37.58785769213,
122.10552464755 37.588329760917,122.10827122959 37.588286845573,
122.1081853989 37.588544337638,122.1088720444 37.588715999015,
122.10947285922 37.588587252982,122.10938702854 37.587213961967,
122.11144696506 37.587128131278,122.11123238834 37.588887660392,
122.11106072696 37.589188067802,122.11161862644 37.589445559867,
122.11161862644 37.590132205375,122.11123238834 37.590518443473,122.11157571109 37.59069010485,
122.11127530368 37.591162173637,122.11157571109 37.591376750358,122.11629639896 37.591376750358,
122.11659680637 37.591033427604,122.11638222965 37.590561358817,122.11676846774 37.590475528129,
122.11629639896 37.589230983146,122.11676846774 37.58927389849,122.1163393143 37.587128131278,
122.1163393143 37.58704230059,122.11891423496 37.58704230059,122.11869965824 37.588544337638,
122.11951504978 37.588587252982,122.11985837253 37.588329760917,122.11985837253 37.588201014884,
122.12260495456 37.588201014884,122.12320576938 37.587900607474,122.123034108 37.58704230059,
122.12427865299 37.587171046622,122.12573777469 37.586613147147,122.12582360538 37.586527316459,
122.12522279056 37.584553210624,122.12487946781 37.584553210624,122.11586724552 37.584767787345,
122.11616765293 37.583651988395,122.11123238834 37.583823649772,122.11170445712 37.584767787345,
122.10625420841 37.584896533378,122.10569630893 37.584681956657,122.10307847293 37.584639041312,
122.10303555759 37.584681956657,122.10243474277 37.586913554557))', 4326)),
(0,st_geomfromText('POLYGON((122.10243474277 37.586913554557,122.10397969516 37.587385623344,
122.10500966342 37.587385623344,122.10496674808 37.587771861442,122.10470925601 37.58785769213,
122.10552464755 37.588329760917,122.10827122959 37.588286845573,122.1081853989 37.588544337638,
122.1088720444 37.588715999015,122.10947285922 37.588587252982,122.10938702854 37.587213961967,
122.11144696506 37.587128131278,122.11123238834 37.588887660392,122.11106072696 37.589188067802,
122.11161862644 37.589445559867,122.11161862644 37.590132205375,122.11123238834 37.590518443473,
122.11157571109 37.59069010485,122.11127530368 37.591162173637,122.11157571109 37.591376750358,
122.11629639896 37.591376750358,122.11659680637 37.591033427604,122.11638222965 37.590561358817,
122.11676846774 37.590475528129,122.11629639896 37.589230983146,122.11676846774 37.58927389849,
122.1163393143 37.587128131278,122.1163393143 37.58704230059,122.11891423496 37.58704230059,
122.11869965824 37.588544337638,122.11951504978 37.588587252982,122.11985837253 37.588329760917,
122.11985837253 37.588201014884,122.12260495456 37.588201014884,122.12320576938 37.587900607474,
122.123034108 37.58704230059,122.12427865299 37.587171046622,122.12573777469 37.586613147147,
122.12582360538 37.586527316459,122.12522279056 37.584553210624,122.12487946781 37.584553210624,
122.11586724552 37.584767787345,122.11616765293 37.583651988395,122.11123238834 37.583823649772,
122.11170445712 37.584767787345,122.10625420841 37.584896533378,122.10569630893 37.584681956657,
122.10307847293 37.584639041312,122.10303555759 37.584681956657,122.10243474277 37.586913554557))', 4326));

转载自:https://blog.csdn.net/wd4java/article/details/45339687

You may also like...