Commit graph

246 commits

Author SHA1 Message Date
Mark Cave-Ayland f517878e4d Alter loader Makefile to add liblwgeom.a dependency, so people who just want to build the shapefile loaders can do "make" within the loader subdirectory and liblwgeom.a will automagically get build first.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3235 b70326c6-7e19-0410-871a-916f4a2858ee
2008-11-04 09:57:03 +00:00
Mark Cave-Ayland 4135d821fd Add missing ICONV_LDFLAGS variable to the loader Makefile. Thanks to Olivier Courtin for noticing.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3225 b70326c6-7e19-0410-871a-916f4a2858ee
2008-11-03 16:23:45 +00:00
Mark Cave-Ayland 34e9e3263c Switch pgsql2shp over to using liblwgeom.
There are few commits that can be as satisfying as one which involves the removal of ~1200 lines of code. By using the liblwgeom parser instead of the in-built parser, we have now achieved the following:

i) all parsers within PostGIS, shp2pgsql and pgsql2shp are now the same which means they all follow the same rules. Also extended error reporting information including error text and position information is available.

ii) the complexity of the shp2pgsql/pgsql2shp is considerably reduced.

The slightly unfortunate cost is the overall executable size is larger, since we are linking with liblwgeom. However, from both a consistency and maintainability point of view, this is a big win. Note that while there may be a difference in behaviour in some corner cases, all regression tests pass here. 



git-svn-id: http://svn.osgeo.org/postgis/trunk@3224 b70326c6-7e19-0410-871a-916f4a2858ee
2008-11-03 16:17:57 +00:00
Mark Cave-Ayland 38babbcb8f Some more shp2pgsql clearups; remove some dead commented code and switch over to use the LWDEBUG(F) debugging framework.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3222 b70326c6-7e19-0410-871a-916f4a2858ee
2008-10-31 10:04:58 +00:00
Mark Cave-Ayland bfb072826b Switch shp2pgsql over to use liblwgeom instead of its own internal parser. Some notes from looking at the code:
i) I've abstracted the I/O formatting functions into a new OutputGeometry() function since it allow the logic concerning output formatting to kept in one place, rather than sprinkled throughout all the other Insert* functions.

ii) InsertPoint() and InsertMultiPoint() have been combined, since it seems that the same code will work for both - all that is required is to know whether to produce a MULTIPOINT collecton or a POINT at the end.

iii) I've added additional comments within the Insert* functions to help clarify what is going on in places

iv) It appears some corner cases were missing within the conversion code with respect to Z/M coordinates, so in theory the new code should do a better job.

All in all, the source code is slightly reduced in size (although of course the binary is larger after linking with liblwgeom), and seems a lot more readable to my eyes. A quick TODO is to go through the file and replace the #if...#endif sections related to debugging with LWDEBUG(F) options.  

NOTE: I've had to change the Makefile to allow linking against the maths library and liblwgeom.a, so some manual intervention on the automated build may be required ;)



git-svn-id: http://svn.osgeo.org/postgis/trunk@3217 b70326c6-7e19-0410-871a-916f4a2858ee
2008-10-30 17:10:44 +00:00
Mark Cave-Ayland e83d625fe1 After several discussions at PGDay, it seems that the only use-case for the PGXS PROGRAM clause is for programs that wish to link with the backend libraries. Hence create a new Makefile for the loader directory which uses the new autoconf infrastructure, based upon library and dependency lists from the original 1.3 branch.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3143 b70326c6-7e19-0410-871a-916f4a2858ee
2008-10-19 14:52:29 +00:00
Mark Cave-Ayland 244c935729 Alter the lwgeom Makefile so that liblwgeom.a is linked directly, rather than using the -L...-l options on the command line. This is to prevent problems on OSX where PGXSadds the PostgreSQL $libdir to the PostGIS link line, causing it to link to liblwgeom.so produced by older versions of PostGIS rather than the static liblwgeom.a.
Also change the PGXS CPP/LIB equivalent variables to use += so that extra compile/link options can be supplied. Per report from Robert Rainthorpe, with thanks to William Kyngesburye.



git-svn-id: http://svn.osgeo.org/postgis/trunk@2918 b70326c6-7e19-0410-871a-916f4a2858ee
2008-08-21 08:45:07 +00:00
Mark Cave-Ayland 4eec27c992 Allow Makefile substitutions for PGCONFIG which are required if pg_config is not located in the path. Note that as part of this fix, we now need to generate topology/Makefile using autoconf. Thanks to Jorgen Austvik for the report and partial patch.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2885 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-28 10:03:31 +00:00
Mark Cave-Ayland e3af7ccce5 Update new Makefile copyrights, also remove compat.h from the loader/ directory since it is now no longer needed.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2805 b70326c6-7e19-0410-871a-916f4a2858ee
2008-06-05 14:47:31 +00:00
Mark Cave-Ayland efad7bcb9e Remove PQunescapeBytea hack from pgsql2shp which is no longer needed, as it was only required for versions of PostgreSQL < 7.3
git-svn-id: http://svn.osgeo.org/postgis/trunk@2801 b70326c6-7e19-0410-871a-916f4a2858ee
2008-06-05 11:07:40 +00:00
Mark Cave-Ayland 020c2c5314 Remove extra warnings related to the shp2pgsql deleted records patch
git-svn-id: http://svn.osgeo.org/postgis/trunk@2785 b70326c6-7e19-0410-871a-916f4a2858ee
2008-05-27 15:08:20 +00:00
Mark Cave-Ayland c8c98e13ab Update new build system to include iconv detection for shp2pgsql
git-svn-id: http://svn.osgeo.org/postgis/trunk@2784 b70326c6-7e19-0410-871a-916f4a2858ee
2008-05-27 14:47:06 +00:00
Paul Ramsey c003fcb382 Fix for DBF files with deleted records. (#29)
git-svn-id: http://svn.osgeo.org/postgis/trunk@2783 b70326c6-7e19-0410-871a-916f4a2858ee
2008-05-27 03:00:12 +00:00
Mark Cave-Ayland cee1f271e5 Commit new build system based upon PGXS. Due to the large number of changes, please refer to http://postgis.refractions.net/pipermail/postgis-devel/2008-May/003010.html.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2774 b70326c6-7e19-0410-871a-916f4a2858ee
2008-05-14 17:10:19 +00:00
Paul Ramsey dda4f481e0 New -n switch to support DBF-only loading of attributes without shapes.
Submitted by Regina Obe.


git-svn-id: http://svn.osgeo.org/postgis/trunk@2764 b70326c6-7e19-0410-871a-916f4a2858ee
2008-04-12 16:44:55 +00:00
Paul Ramsey 15f227436b Reduce FTDate field size to 8 bytes from 10. Matches other calls in the file
now, no good explanation in code why it was 10 to start with.
http://postgis.refractions.net/pipermail/postgis-users/2008-April/019169.html


git-svn-id: http://svn.osgeo.org/postgis/trunk@2762 b70326c6-7e19-0410-871a-916f4a2858ee
2008-04-10 14:44:26 +00:00
Paul Ramsey 479d0b8054 Change sr_id into an integer, per mca's suggestion.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2760 b70326c6-7e19-0410-871a-916f4a2858ee
2008-04-09 19:52:19 +00:00
Paul Ramsey 9a06f4b121 Fix string literal comparison warnings: "comparison with string literal results in
unspecified behaviour"


git-svn-id: http://svn.osgeo.org/postgis/trunk@2759 b70326c6-7e19-0410-871a-916f4a2858ee
2008-04-08 21:36:50 +00:00
Paul Ramsey 6c6a4e3bee Rename all occurances of getopt to pgis_getopt to work around
OS/X 10.5 system function name collision.


git-svn-id: http://svn.osgeo.org/postgis/trunk@2758 b70326c6-7e19-0410-871a-916f4a2858ee
2008-04-07 20:09:48 +00:00
Mark Cave-Ayland 55bb8de2d3 Rewrite the pgsql2shp connection string code so that it uses a connection string, rather than setting environment variables. MingW-compiled and MSVC-compiled apps seem to have great problems passing the variables to each other, causing regression to fail. With this fix (and a Makefile tweak), it is now possible to run a MingW-compiled PostGIS against an MSVC compiled PostgreSQL and pass all regression tests.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2726 b70326c6-7e19-0410-871a-916f4a2858ee
2008-01-11 15:04:05 +00:00
Mark Cave-Ayland 723938663d Apply Tom Glancy's patch to shp2pgsql which corrects an off-by-one error in the field_width calculation when determining which SQL numeric type is required depending upon the length of the corresponding shapefile field. This should eliminate various out of range error messages that may have appeared when attempting to load a converted shapefile into PostgreSQL.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2717 b70326c6-7e19-0410-871a-916f4a2858ee
2007-11-23 10:42:09 +00:00
Mark Cave-Ayland d6d58efee5 Apply parts of Charlie Savage's MSVC patch - mainly tidying up variable allocations so they appear at the start of functions, but also making better use of the pj_get_errno_ref() which gets rid of the auto-import warnings on MingW.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2715 b70326c6-7e19-0410-871a-916f4a2858ee
2007-10-29 16:29:58 +00:00
Mark Leslie 369b892a5a Updated the loader to create the index after the data has been loaded.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2667 b70326c6-7e19-0410-871a-916f4a2858ee
2007-07-23 16:29:40 +00:00
Mark Leslie c0f439fc1c Upgraded the escaping of quotes from the deprecated backslashing to the doubling of quotes.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2662 b70326c6-7e19-0410-871a-916f4a2858ee
2007-07-16 18:06:32 +00:00
Mark Cave-Ayland ec2bcb7231 Rollback experimental shp2pgsql escaping change that accidently got included in the last commit :(
git-svn-id: http://svn.osgeo.org/postgis/trunk@2657 b70326c6-7e19-0410-871a-916f4a2858ee
2007-07-13 05:48:32 +00:00
Mark Cave-Ayland e03234e557 Correct previous commit for older PostgreSQL versions - the order of the methods in PROJ4SRSCacheContextMethods is not consistent between versions.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2656 b70326c6-7e19-0410-871a-916f4a2858ee
2007-07-13 05:42:46 +00:00
Markus Schaber 80ec5d842c sanitized usage info output on loader/dumper
git-svn-id: http://svn.osgeo.org/postgis/trunk@2513 b70326c6-7e19-0410-871a-916f4a2858ee
2006-10-14 14:22:10 +00:00
Markus Schaber 5d1e29cdc7 Cleaned up Version.config & co.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2512 b70326c6-7e19-0410-871a-916f4a2858ee
2006-10-14 09:26:13 +00:00
Markus Schaber 8a050ec60c fix ARC regression test failures in loader
git-svn-id: http://svn.osgeo.org/postgis/trunk@2506 b70326c6-7e19-0410-871a-916f4a2858ee
2006-10-11 11:19:54 +00:00
Sandro Santilli 40750750a8 Fixed a bug in InsertLineStringWKT, also fixed some typos
git-svn-id: http://svn.osgeo.org/postgis/trunk@2504 b70326c6-7e19-0410-871a-916f4a2858ee
2006-10-11 10:00:24 +00:00
Markus Schaber 25a72ae95d added -S option and updated README to loader/dumper
git-svn-id: http://svn.osgeo.org/postgis/trunk@2503 b70326c6-7e19-0410-871a-916f4a2858ee
2006-10-11 09:43:29 +00:00
Sandro Santilli ad35244447 lower default verbosity level
git-svn-id: http://svn.osgeo.org/postgis/trunk@2485 b70326c6-7e19-0410-871a-916f4a2858ee
2006-09-27 08:23:40 +00:00
Sandro Santilli 1fdc2bacfe Encode pgsql2shp process pid into temporary table name, to reduce likelyhood of name clashes.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2478 b70326c6-7e19-0410-871a-916f4a2858ee
2006-09-25 08:27:02 +00:00
Paul Ramsey 65bc16833f Added fix for null dates that are encoded as '' instead of 00000000.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2472 b70326c6-7e19-0410-871a-916f4a2858ee
2006-09-09 16:32:57 +00:00
Sandro Santilli 7785157dfa - BUGFIX in pgsql2shp successful return code.
- BUGFIX in shp2pgsql handling of MultiLine WKT.


git-svn-id: http://svn.osgeo.org/postgis/trunk@2383 b70326c6-7e19-0410-871a-916f4a2858ee
2006-06-16 14:12:17 +00:00
Sandro Santilli d1585244ce Limited text field size to 255 (bug #84) [will eventually provide a switch to support wider fields ]
git-svn-id: http://svn.osgeo.org/postgis/trunk@2334 b70326c6-7e19-0410-871a-916f4a2858ee
2006-04-18 14:09:28 +00:00
Sandro Santilli eb41094120 Substituted bzero() use with memset()
git-svn-id: http://svn.osgeo.org/postgis/trunk@2328 b70326c6-7e19-0410-871a-916f4a2858ee
2006-04-18 09:16:26 +00:00
Sandro Santilli f99fa349f3 Swapped stdint.h (unavailable on Solaris9) with inttypes.h
git-svn-id: http://svn.osgeo.org/postgis/trunk@2303 b70326c6-7e19-0410-871a-916f4a2858ee
2006-02-03 20:53:37 +00:00
Sandro Santilli 89cc24dc01 Added support for Bool and Date DBF<=>PGIS mapping
git-svn-id: http://svn.osgeo.org/postgis/trunk@2280 b70326c6-7e19-0410-871a-916f4a2858ee
2006-01-16 10:42:58 +00:00
Sandro Santilli 145bf17937 ISO C90 comments, signedness mismatch fixes
git-svn-id: http://svn.osgeo.org/postgis/trunk@2274 b70326c6-7e19-0410-871a-916f4a2858ee
2006-01-09 16:40:16 +00:00
Sandro Santilli 58a5c34a08 Added support for mixed libiconv/iconv
git-svn-id: http://svn.osgeo.org/postgis/trunk@2226 b70326c6-7e19-0410-871a-916f4a2858ee
2005-12-16 16:47:24 +00:00
Sandro Santilli 3d91194f92 Reworked NULL geometries handling code letting user specify policy (insert,skip,abort). Insert is the default.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2010 b70326c6-7e19-0410-871a-916f4a2858ee
2005-11-01 09:25:47 +00:00
Sandro Santilli 4fba191633 fixed wrong assumption about maximum size of integer attributes (width is maximum size of text representation)
git-svn-id: http://svn.osgeo.org/postgis/trunk@1993 b70326c6-7e19-0410-871a-916f4a2858ee
2005-10-24 15:54:22 +00:00
Sandro Santilli 574f208bae Fixed a bug in string attributes handling truncating values of maximum
allowed length, curtesy of Lars Roessiger.
Reworked integer attributes handling to be stricter in dbf->sql mapping
and to allow for big int8 values in sql->dbf conversion


git-svn-id: http://svn.osgeo.org/postgis/trunk@1987 b70326c6-7e19-0410-871a-916f4a2858ee
2005-10-24 11:30:59 +00:00
Sandro Santilli 647fccede9 Applied patch by Lars Roessiger handling numerical values with a trailing decima
l dot


git-svn-id: http://svn.osgeo.org/postgis/trunk@1982 b70326c6-7e19-0410-871a-916f4a2858ee
2005-10-21 11:33:55 +00:00
Sandro Santilli 5e4240a18d Fixed return code from shp2pgsql
git-svn-id: http://svn.osgeo.org/postgis/trunk@1963 b70326c6-7e19-0410-871a-916f4a2858ee
2005-10-13 13:40:20 +00:00
Sandro Santilli 850f2134c2 Stricter string attributes lenght handling. DBF header will be used
to set varchar maxlenght, (var)char typmod will be used to set DBF header
len.


git-svn-id: http://svn.osgeo.org/postgis/trunk@1957 b70326c6-7e19-0410-871a-916f4a2858ee
2005-10-03 18:08:55 +00:00
Sandro Santilli 3b31451ce0 Issued a warning when -W is specified and no UTF8 support has been compiled in.
git-svn-id: http://svn.osgeo.org/postgis/trunk@1953 b70326c6-7e19-0410-871a-916f4a2858ee
2005-10-03 07:45:58 +00:00
Sandro Santilli 04a5f3105c Fixed release of stack memory occurring when shp2pgsql is compiled with USE_ICONV defined, an attribute value needs to be escaped and no -W is used
git-svn-id: http://svn.osgeo.org/postgis/trunk@1949 b70326c6-7e19-0410-871a-916f4a2858ee
2005-09-30 08:59:29 +00:00
Sandro Santilli 421f400eef Removed premature object destruction in InsertLineString{WKT,} causing segfault
git-svn-id: http://svn.osgeo.org/postgis/trunk@1879 b70326c6-7e19-0410-871a-916f4a2858ee
2005-08-29 22:36:25 +00:00