[Mapserver-users] SHP file simplification (continued)

Steve Lime steve.lime at dnr.state.mn.us
Mon Dec 16 10:20:33 PST 2002


--=_D884166A.CEAFD836
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Content-Disposition: inline

Attached is perl mapscript that does line thinning. It's a port of the
ArcView thinning
script. A bit slow but seems to work fine.

Steve

Stephen Lime
Data & Applications Manager

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> Frédérique Boyer <frederique.boyer at infotracs.net> 10/04/02 07:30AM
>>>
Hi all,

It seems, my first explanation was not very good ;-)

whe already have selected the major roads when we display 100 to 600
kilometers.

My problem is not this selection !

It is to find a tool able to reduce the number of vectors in a
shapefile. (or number or nodes)

hope it exists !!!

Thanks a lot

Frederique

--=_D884166A.CEAFD836
Content-Type: application/octet-stream; name="thin.pl"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="thin.pl"

IyEvdXNyL2Jpbi9wZXJsCgojIFNjcmlwdDogVGhpbi5wbCAKIyAKIyBQdXJwb3NlOiBBbiBhZGFw
dGlvbiBvZiB0aGUgQXJjVmlldyBBdmVudWUgZXhhbXBsZSBzY3JpcHQgZ2VuZmVhdC5hdmUuIEl0
J3MKIyAgICAgICAgICBiYXNpY2FsbHkgdGhlIERvdWdsYXMtUGV1Y2tlciBnZW5lcmFsaXphdGlv
biBhbGdvcml0aG0uCiMKIyBJbml0aWFsIENvZGluZzogMDQvMTAvMjAwMAojIExhc3QgTW9kaWZp
ZWQ6IDA0LzE3LzIwMDAKIyBWZXJzaW9uOiAxLjEKIwojIEF1dGhvcjogU3RlcGhlbiBMaW1lIChz
dGV2ZS5saW1lQGRuci5zdGF0ZS5tbi51cykKCnVzZSBQT1NJWDsKdXNlIFhCYXNlOwp1c2UgbWFw
c2NyaXB0Owp1c2UgR2V0b3B0OjpMb25nOwoKJkdldE9wdGlvbnMoImlucHV0PXMiLCBcJGluZmls
ZSwKCSAgICAib3V0cHV0PXMiLCBcJG91d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