Another question about shapefiles

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Mon Nov 15 07:12:07 EST 2004


Joseph,

In the C interface I think you can open a file in mode "rb+" which will
allow you to read/write, BUT in general practice I would open the file
for read, copy it record by record, and then add any new data to the
file. Otherwise you run the risk of damaging your original file.
Typically if you need to do this via a multi-user interface, like a web
form you need to edit a database and not a shapefile as this library has
not locking and it WILL get trashed.

-Steve

Joseph Norris wrote:

> Stephen,
>
> These are really great - I was able to build my shape file from zip file
> very easily.  Now the question is - and I have experimented.
>
> I see in the Shapelib docs I see that I can open a shapefile that already
> exists.  Can I then read another file of points and the put these points on
> the original shape?
>
> No matter what I do I am getting errors back.   I can only find examples of
> code in the pod for the module.
>
> Thanks for all your help.
>
> #Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql) print @c=map chr
> $_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,-68,4,-3,-1,7,1,14,-
> 68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
>
> -----Original Message-----
> From: UMN MapServer Users List [mailto:MAPSERVER-USERS at lists.umn.edu]On
> Behalf Of Stephen Woodbridge
> Sent: Sunday, November 14, 2004 6:14 PM
> To: MAPSERVER-USERS at lists.umn.edu
> Subject: Re: [UMN_MAPSERVER-USERS] Another question about shapefiles
>
> Joseph,
>
> Check out perl modules:
>
> Geo::ShapeFile
> Geo::Shapelib
> XBase
>
> These are handy modules for working with shapefiles and the DBF
> attributes file. I write scripts all the time for creating, reading and
> manipulating shapefiles. When I need more performance I usually use the
> shapelib library and C code.
>
> -Steve
>
> Joseph Norris wrote:
>
>>I have a US zip file containing zip codes and associated lat/long
>>information.  Can I convert this to points on a shapefile?
>>
>>#Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql) print @c=map
>
> chr
>
> $_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,-68,4,-3,-1,7,1,14,-
>
>>68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
>>
>
>



More information about the mapserver-users mailing list