Another question about shapefiles

Joseph Norris sirronj at PACBELL.NET
Mon Nov 15 10:11:55 EST 2004


Steve,

Thanks for this information.  I understand this.  However here is my
situation.  I have a shapefile of California.  It has its dbf file.

This is a sample:

0.859846443800379:5.7057500729921:50:49:06:053:Monterey:06:County
1.25622233242418:5.28286812594892:51:50:06:107:Tulare:06:County


I have another text file of zip codes with lat/long codes.

"01","35004","AL","ACMAR",86.51557,33.584132,6055,0.001499
"01","35005","AL","ADAMSVILLE",86.959727,33.588437,10616,0.002627
"01","35006","AL","ADGER",87.167455,33.434277,3205,0.000793
"01","35007","AL","KEYSTONE",86.812861,33.236868,14218,0.003519
"01","35010","AL","NEW SITE",85.951086,32.941445,19942,0.004935
"01","35014","AL","ALPINE",86.208934,33.331165,3062,0.000758


I have the whole US - so I have California.

What I am trying to accomplish is to layer the zip code data on top of
California an by that read a Mysql user table and by zip code place a symbol
where these users are located.

I am doing all of this from a ESRI background that would have made this an
easier via the GUI but not as much fun and definitely not Open Source.


  BTW - I am doing all of this as proof of concept so that my company will
get into GIS as an extension of  one of the best Open Source  content
management systems I have ever worked on - OK - enough of that - but it is a
really well designed product.

#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: Stephen Woodbridge [mailto:woodbri at swoodbridge.com]
Sent: Monday, November 15, 2004 4:12 AM
To: Joseph Norris
Cc: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] Another question about shapefiles

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