Shapefile creation

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Shapefile creation

Mike.Sexton

Hi,

 

For some time I have been wondering how one produces shapefiles from scratch and have found it very difficult to find relevant information

I have numerous files of X,Y data that describe points, lines and polygons that I wnt to capture as shapefiles.

 

Fortunately I found  the shapelib pages

 

I downloaded the shapelib tar file and shocked myself when the make worked.

 

I have been able to make some simple shapefiles by following the instructions, and I am now wondering how I can use my X,Y files.

 

For example: shpadd testfile.shp 10.0 1.0 20.0 2.0 30.0 3.0, works fine

 

but I want to load an X,Y file containing 1000’s of point into the shapefile. I just cant see how to stream the coordinates into the ahpadd program

 

Any advice would be greatly appreciated

 

 

Thanks

Mike Sexton

Geoscience Australia


_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Reply | Threaded
Open this post in threaded view
|

Re: Shapefile creation

Frank Warmerdam-2
[hidden email] wrote:

> Hi,
>
>  
>
> For some time I have been wondering how one produces shapefiles from
> scratch and have found it very difficult to find relevant information
>
> I have numerous files of X,Y data that describe points, lines and
> polygons that I wnt to capture as shapefiles.
>
>  
>
> Fortunately I found  the shapelib pages
>
>  
>
> I downloaded the shapelib tar file and shocked myself when the make worked.
>
>  
>
> I have been able to make some simple shapefiles by following the
> instructions, and I am now wondering how I can use my X,Y files.
>
>  
>
> For example: shpadd testfile.shp 10.0 1.0 20.0 2.0 30.0 3.0, works fine
>
>  
>
> but I want to load an X,Y file containing 1000’s of point into the
> shapefile. I just cant see how to stream the coordinates into the ahpadd
> program
>
>  
>
> Any advice would be greatly appreciated

Mike,

If you have even a modest mastery of C/C++, it should be possible to modify
the shpadd program to do what you want.  Shpadd is really just intended
as a modest example of using the api.

If not, well, perhaps you could use some other scripting language to
transform your text file into a bunch of shpadd calls?  If not, perhaps
you will have to beg a programmer of some stripe to help.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Reply | Threaded
Open this post in threaded view
|

Re: Shapefile creation

Mateusz Loskot
In reply to this post by Mike.Sexton
[hidden email] wrote:
> For example: shpadd testfile.shp 10.0 1.0 20.0 2.0 30.0 3.0, works fine
>
> but I want to load an X,Y file containing 1000’s of point into the
> shapefile. I just cant see how to stream the coordinates into the ahpadd
> program
>
> Any advice would be greatly appreciated

Mike,

Here is a tiny script that shows how to use shapelib with Python
and generates shapefiles with 500 point features:

http://mateusz.loskot.net/tmp/genshp.py

Feel free to use and customize it for your purposes.
It should be easy to change this script to read points from text file,
construct shape geometry and load to shapefile.

Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Reply | Threaded
Open this post in threaded view
|

Re: Shapefile creation

David.Gancarz
In reply to this post by Mike.Sexton

To add yet another way to do this, there is a sample program in http://dl.maptools.org/dl/shapelib/contrib/ MapToolsArchive.zip that does what you have described, only it gets the xy values from a SqlServer database.  It would be easy enough to stream data in from a file instead.  It is in c#.

btw, the boilerplate text about Florida's public records law is a new directive from our legal department --- don't blame me :-(

Hope this helps,
David Gancarz

Florida has a very broad public records law.  As a result, any written communication created or received by City of Orlando officials and employees will be made available to the public and media, upon request, unless otherwise exempt.  Under Florida law, email addresses are public records.  If you do not want your email address released in response to a public records request, do not send electronic mail to this office.  Instead, contact our office by phone or in writing.



<[hidden email]>
Sent by: [hidden email]

10/30/2006 11:31 PM

Please respond to
Shapelib Development <[hidden email]>

To
<[hidden email]>
cc
Subject
[Shapelib] Shapefile creation





Hi,
 
For some time I have been wondering how one produces shapefiles from scratch and have found it very difficult to find relevant information
I have numerous files of X,Y data that describe points, lines and polygons that I wnt to capture as shapefiles.
 
Fortunately I found  the shapelib pages
 
I downloaded the shapelib tar file and shocked myself when the make worked.
 
I have been able to make some simple shapefiles by following the instructions, and I am now wondering how I can use my X,Y files.
 
For example: shpadd testfile.shp 10.0 1.0 20.0 2.0 30.0 3.0, works fine
 
but I want to load an X,Y file containing 1000’s of point into the shapefile. I just cant see how to stream the coordinates into the ahpadd program
 
Any advice would be greatly appreciated
 
 
Thanks
Mike Sexton
Geoscience Australia_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib


_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib