[gdal-dev] please help me check my code about transforming pg data
to shape
windwxc at sina.com
windwxc at sina.com
Sat Apr 26 04:39:26 EDT 2008
IGhpLGV2ZXJ5IG9uZS4gSSBuZWVkIHJlYWQgdGhlIHNwYXRpYWwgZGF0YSBpbiBwb3N0Z3Jlc3Fs
IGFuZCB0cmFuc2Zvcm0gaXQgdG8gc2hhcGUgZmlsZSBhbmQgc2hvdyBpdCBieSBheG1hcGNvbnRy
b2wgaW4gbXkgcHJvamVjdC4gTXkgY29kZSBjYW4gcnVuIGJ1dCB3aGVuIGkgdXNlIGFyY21hcCBv
cGVuIHRoZSBuZXcgc2hhcGUgZmlsZSBpIGZpbmQgaXQgY2Fubm90IHNob3cgYW55IGdyYXBoaWNz
IGFuZCB0aGUgYXR0cmlidXRlIHRhYmxlIGlzIGVtcHR5LiB0aGUgc2l6ZSBvZiB0aGUgc2hhcGUg
aXNub3QgMGsuIEkgcnVuIHNhbWUgY29kZSBidXQgb25seSBvbmNlIHRoZSBzaGFwZSBmaWxlIGNh
biBzaG93IGdyYXBoaWMgYW5kIGNhbiBiZSBzZWVuIHRoZSBhcnJ0aWJ1dGUuIFRoZSBmb2xsb3dp
bmcgaXMgY29kZSBhbmQgaSB3aXNoIHlvdSBjYW4gaGVscCBtZSBmaW5kIHdoZXJlIGlzIGVycm9y
Lg0KcHVibGljIHZvaWQgR2V0R2VvbWV0cnkoc3RyaW5nIHNxbHRleHQpDQogICAgICAgIHsNCiAg
ICAgICAgICAvLyAgb3BlbiB0aGUgcG9zdGdpcyBhbmQgcmVhZCBkYXRhIGFjY29yZGluZyAgc3Fs
dGV4dCAgICAgIA0KICAgICAgICAgIHRyeSAgICAgICAgICAgICAgeyANCiAgICAgICAgICAgICAg
IA0KICAgICAgICAgICAgICAgIHRyeQ0KICAgICAgICAgICAgICAgIHsNCiAgICAgICAgICAgICAg
ICAgICAgT2dyLlJlZ2lzdGVyQWxsKCk7DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAg
ICAgIGN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gbXlzcGF0aWFsID0gbmV3
IFNwYXRpYWxSZWZlcmVuY2UoIiIpOw0KICAgICAgICAgICAgICAgICAgIG15c3BhdGlhbC5JbXBv
cnRGcm9tUHJvajQoIitwcm9qPVRyYW5zdmVyc2VfTWVyY2F0b3IgK3pvbmU9NDhOK2RhdHVtPUdD
U19XR1NfMTk4NCIpOw0KICAgICAgICAgICAgICAgICAgIHNocGNvbm4gPSBzaHBkcml2ZXIuQ3Jl
YXRlRGF0YVNvdXJjZShwYXRoLCBudWxsKTsNCiAgICAgICAgICAgICAgICAgICBPU0dlby5PR1Iu
TGF5ZXIgbXlzaHBsYXkgPSBzaHBjb25uLkNyZWF0ZUxheWVyKCJ5YW50aWFuMjAwNSIsIG51bGwg
LCBPU0dlby5PR1Iud2tiR2VvbWV0cnlUeXBlLndrYlBvbHlnb24sIG51bGwpOw0KICAgICAgICAg
ICAgICAgICAgIGlmIChteXNocGxheSA9PSBudWxsKQ0KICAgICAgICAgICAgICAgICAgIHsNCiAg
ICAgICAgICAgICAgICAgICAgICAgTWVzc2FnZUJveC5TaG93KCJjcmVhdGUgbGF5ZXIgZmFpbG9y
ISIpOw0KICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgIA0KICAgICAgICAgICAg
ICAgICAgIE9TR2VvLk9HUi5GZWF0dXJlIG15T0dSRmVhdCA9IG51bGw7DQogICAgICAgICAgICAg
ICAgICAgZm9yIChpbnQgaSA9IDA7IGkgDQogICAgICAgICAgICAgICAgICAgICAgIE9TR2VvLk9H
Ui5HZW9tZXRyeSBteUdlb20gPSBteU9HUkZlYXQuR2V0R2VvbWV0cnlSZWYoKTsNCiAgICAgICAg
ICAgICAgICAgICAgICAgbXlPR1JmdC5TZXRHZW9tZXRyeShteUdlb20pOw0KICAgICAgICAgICAg
ICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSANCiAgICAgICAgICAgICAgICAgICAgICAgICAg
IGlmIChteUZpZUQuR2V0RmllbGRUeXBlKCkgPT0gT1NHZW8uT0dSLkZpZWxkVHlwZS5PRlRTdHJp
bmcpDQogICAgICAgICAgICAgICAgICAgICAgICAgICB7DQogICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgbXlPR1JmdC5TZXRGaWVsZChpLCBteU9HUkZlYXQuR2V0RmllbGRBc1N0cmluZyhp
KSk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAg
ICAgICBlbHNlIGlmIChteUZpZUQuR2V0RmllbGRUeXBlKCkgPT0gT1NHZW8uT0dSLkZpZWxkVHlw
ZS5PRlRJbnRlZ2VyKQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgew0KICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgIG15T0dSZnQuU2V0RmllbGQoaSwgbXlPR1JGZWF0LkdldEZpZWxk
QXNEb3VibGUoaSkpOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAg
ICAgICAgICAgICAgICAgZWxzZSBpZiAobXlGaWVELkdldEZpZWxkVHlwZSgpID09IE9TR2VvLk9H
Ui5GaWVsZFR5cGUuT0ZUSW50ZWdlcikNCiAgICAgICAgICAgICAgICAgICAgICAgICAgIHsNCiAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBteU9HUmZ0LlNldEZpZWxkKGksIG15T0dSRmVh
dC5HZXRGaWVsZEFzSW50ZWdlcihpKSk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICB9DQog
ICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgbXlPR1JmdCA9
IG15T0dSRmVhdC5DbG9uZSgpOw0KICAgICAgICAgICAgICAgICAgICAgICBteU9HUmZ0LlNldEZy
b20obXlPR1JGZWF0LCAxKTsNCiAgICAgICAgICAgICAgICAgICAgICANCiAgICAgICAgICAgICAg
ICAgICAgICAgbXlzaHBsYXkuQ3JlYXRlRmVhdHVyZShteU9HUmZ0KTsNCiAgICAgICAgICAgICAg
ICAgICAgDQogICAgICAgICAgICAgICAgICAgICAgIGNvdW50ID0gY291bnQgKyAxOw0KICAgICAg
ICAgICAgICAgICAgICAgICBteU9HUmZ0LkRpc3Bvc2UoKTsNCiAgICAgICAgICAgICAgICAgICB9
IA0KICAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAgIGF4TWFwQ29udHJvbDEu
QWN0aXZlVmlldy5Gb2N1c01hcC5DbGVhckxheWVycygpOw0KICAgICAgICAgICAgICAgICAgIGF4
TWFwQ29udHJvbDEuQWRkTGF5ZXJGcm9tRmlsZShBcHBsaWNhdGlvbi5TdGFydHVwUGF0aCArICJc
XGRhdGFiYXNlXFx5YW50aWFuMjAwNS5zaHAiLDApOw0KICAgICAgICAgICAgICAgICAgICBheE1h
cENvbnRyb2wxLkFjdGl2ZVZpZXcuUmVmcmVzaCgpOw0KICAgICAgICAgICAgICAgICAgIC8vcGdj
b25uLkRpc3Bvc2UoKTsNCiAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgY2F0Y2gg
KEV4Y2VwdGlvbiBlKQ0KICAgICAgICAgICAgICAgeyBNZXNzYWdlQm94LlNob3coIGUuTWVzc2Fn
ZSk7DQogICAgICAgICAgICAgIC8vIGNvbm4uRGlzcG9zZSgpOw0KICAgICAgICAgICAgICAgQXBw
bGljYXRpb24uRXhpdCgpOw0KICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KICAgICAg
ICAgICAgY2F0Y2ggKEV4Y2VwdGlvbiBlKQ0KICAgICAgICAgICAgew0KICAgICAgICAgICAgICAg
IE1lc3NhZ2VCb3guU2hvdyggZS5NZXNzYWdlKTsNCiAgICAgICAgICAgIH0gICAgIA0KICAgICAg
ICAgfQ0KaSBrbm93IHNvbWUgbXkgY29kZSBpcyBydWR1bmRhbnQgYW5kIHdpc2ggeW91IGNhbiBw
b2ludCBvdXQuDQp0aGFuayB5b3UgDQpiZXN0IHJlZ2FyZC4NCnBzOiB3aXNoIHRoaXMgbXkgZW1h
aWwgaXMgcmlnaHQgLg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRzbm93CgotLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCs/r
zea1w76rssqjv7/swLS73cbVIs7StcS158TUIM7StcTO6MyoIiggaHR0cDovL2QxLnNpbmEuY29t
LmNuL3NpbmEvbGltZW5nMy9tYWlsX3podWl5dS8yMDA4L21haWxfemh1aXl1XzIwMDgwNDIxLmh0
bWwgKQoKLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLQrXorLh0MLAyzJHw+K30dPKz+SjqGh0dHA6Ly9tYWlsLnNpbmEuY29t
LmNuL6Op
More information about the gdal-dev
mailing list