资源简介
shp导入mysql工具,我也是从网上下的,找了好久.
代码片段和文件信息
// **********************************************************
// *** BJK = quick and dirty hack to make it work for MySQL alpha 4.1
// *** Barend K鯾ben
// ** WARNING: NO TESTING DONE TO SPEAK OFF !!!
// version 0.2 - november 2003
// port from PostGIS SQL to MySQL
// version 0.3 - may 2004
// changed all coordinate output to fixed decimal places as JTS does not accept 1234e-xxx notation
// version 0.4 - July 2004
// changed primary from being called gid to ID
// fixed a bug where Add geometry statement was not endend properly with “;“
//
//**********************************************************
// released under GPL http://www.gnu.org/copyleft/gpl.html
//
//*** ORIGINAL:
/*
* $Id: shp2pgsql.cv 1.33 2003/04/01 23:02:50 jeffloun Exp $
*
* Author: Jeff Lounsbury jeffloun@refractions.net
*
* $Log: shp2pgsql.cv $
* Revision 1.33 2003/04/01 23:02:50 jeffloun
*
* Fixed a bug which dropped the last Z value of each line in 3d lines.
*
* Revision 1.32 2003/03/07 16:39:53 pramsey
* M-handling patch and some Z-recognition too.
* From strk@freek.keybit.net.
*
* Revision 1.31 2003/02/15 00:27:14 jeffloun
* added more type checking into the create table statment.
* Now uses int8 and numeric types if the columns definitions are too big
*
* Revision 1.30 2003/02/14 20:07:26 jeffloun
* changed the PIP function to loop from i=0 to 1 *
* Revision 1.29 2003/02/04 22:57:44 pramsey
* Fix memory management error array of pointers allocated insufficient space.
*
* Revision 1.28 2003/02/04 21:39:20 pramsey
* Added CVS substitution strings for logging.
*
*
* Using shapelib 1.2.8 this program reads in shape files and
* processes it‘s contents into a Insert statements which can be
* easily piped into a database frontend.
* Specifically designed to insert type ‘geometry‘ (a custom
* written PostgreSQL type) for the shape files and PostgreSQL
* standard types for all attributes of the entity.
*/
#include “shapefil.h“
#include
#include
#include
#include “getopt.h“
typedef struct {double x y z;} Point;
typedef struct Ring{
Point *list; //list of points
struct Ring *next;
int n; //number of points in list
} Ring;
int dump_format = 0; //0=insert statements 1 = dump
int Insert_attributes(DBFHandle hDBFHandle int row);
char *make_good_string(char *str);
int ring_check(SHPobject* obj char *table char *sr_id int rings
DBFHandle hDBFHandle);
char *protect_quotes_string(char *str);
int PIP( Point P Point* V int n );
char *make_good_string(char *str){
//find all the tabs and make them \s
//
// 1. find # of tabs
// 2. make new string
//
// we dont escape already escaped tabs
char *result;
char *str2;
char *start*end;
int num_tabs = 0;
(str2) = (str);
while ((str2 = strchr(str2 ‘\t‘)) )
{
if ( (str2 == str) || (str2[-1] != ‘\\‘) ) //the previous char isnt a ‘\‘
num_tabs ++;
str2++;
}
if (num_tabs == 0)
return str;
re
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2004-07-09 11:34 src\
文件 9544 2003-11-04 19:20 src\dbfopen.o
文件 4376 2001-10-22 20:13 src\getopt.h
文件 4701 2003-11-04 19:20 src\getopt.o
文件 285 2003-11-10 14:48 src\Makefile
文件 13192 2002-05-04 22:44 src\shapefil.h
文件 33877 2004-07-09 11:34 src\shp2mysql.c
文件 18636 2004-07-09 11:24 src\shp2mysql.o
文件 33522 2004-05-17 12:46 src\shp2mysql_0.2.c
文件 16937 2003-11-04 19:20 src\shpopen.o
文件 971618 2003-09-20 20:32 cygwin1.dll
文件 1497 2004-11-18 20:49 DOShere.lnk
文件 53855 2004-07-09 11:26 shp2mysql.exe
文件 2794 2005-03-31 19:23 shp2mysqlReadme.txt
评论
共有 条评论