geo_coder 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +12 -0
- data/Gemfile.lock +32 -0
- data/History.txt +6 -0
- data/Makefile +13 -0
- data/Manifest.txt +18 -0
- data/README.rdoc +197 -0
- data/Rakefile +53 -0
- data/TODO.txt +8 -0
- data/VERSION +1 -0
- data/bin/build_indexes +8 -0
- data/bin/rebuild_cluster +22 -0
- data/bin/rebuild_metaphones +23 -0
- data/bin/tiger_import +59 -0
- data/demos/demo/app/ext/geocodewrap.rb +84 -0
- data/demos/demo/app/views/index.builder +13 -0
- data/demos/demo/app/views/index.erb +71 -0
- data/demos/demo/config.ru +12 -0
- data/demos/demo/config/bootstraps.rb +130 -0
- data/demos/demo/config/geoenvironment.rb +25 -0
- data/demos/demo/geocoder_helper.rb +12 -0
- data/demos/demo/geocom_geocode.rb +10 -0
- data/demos/demo/main.rb +3 -0
- data/demos/demo/rakefile.rb +17 -0
- data/demos/demo/tmp/restart.txt +0 -0
- data/demos/simpledemo/views/index.builder +13 -0
- data/demos/simpledemo/views/index.erb +69 -0
- data/demos/simpledemo/ws.rb +83 -0
- data/doc/Makefile +7 -0
- data/doc/html4css1.css +279 -0
- data/doc/lookup.rst +193 -0
- data/doc/parsing.rst +125 -0
- data/doc/voidspace.css +147 -0
- data/geo_coder.gemspec +172 -0
- data/lib/geocoder/us.rb +21 -0
- data/lib/geocoder/us/address.rb +290 -0
- data/lib/geocoder/us/constants.rb +670 -0
- data/lib/geocoder/us/database.rb +745 -0
- data/lib/geocoder/us/import.rb +181 -0
- data/lib/geocoder/us/import/tiger.rb +13 -0
- data/lib/geocoder/us/numbers.rb +58 -0
- data/navteq/README +4 -0
- data/navteq/convert.sql +37 -0
- data/navteq/navteq_import +39 -0
- data/navteq/prepare.sql +92 -0
- data/sql/cluster.sql +16 -0
- data/sql/convert.sql +80 -0
- data/sql/create.sql +37 -0
- data/sql/index.sql +12 -0
- data/sql/place.csv +104944 -0
- data/sql/place.sql +104948 -0
- data/sql/setup.sql +78 -0
- data/src/Makefile +13 -0
- data/src/README +14 -0
- data/src/liblwgeom/Makefile +75 -0
- data/src/liblwgeom/box2d.c +54 -0
- data/src/liblwgeom/lex.yy.c +4799 -0
- data/src/liblwgeom/liblwgeom.h +1405 -0
- data/src/liblwgeom/lwalgorithm.c +946 -0
- data/src/liblwgeom/lwalgorithm.h +52 -0
- data/src/liblwgeom/lwcircstring.c +759 -0
- data/src/liblwgeom/lwcollection.c +541 -0
- data/src/liblwgeom/lwcompound.c +118 -0
- data/src/liblwgeom/lwcurvepoly.c +86 -0
- data/src/liblwgeom/lwgeom.c +886 -0
- data/src/liblwgeom/lwgeom_api.c +2201 -0
- data/src/liblwgeom/lwgparse.c +1219 -0
- data/src/liblwgeom/lwgunparse.c +1054 -0
- data/src/liblwgeom/lwline.c +525 -0
- data/src/liblwgeom/lwmcurve.c +125 -0
- data/src/liblwgeom/lwmline.c +137 -0
- data/src/liblwgeom/lwmpoint.c +138 -0
- data/src/liblwgeom/lwmpoly.c +141 -0
- data/src/liblwgeom/lwmsurface.c +129 -0
- data/src/liblwgeom/lwpoint.c +439 -0
- data/src/liblwgeom/lwpoly.c +579 -0
- data/src/liblwgeom/lwsegmentize.c +1047 -0
- data/src/liblwgeom/lwutil.c +369 -0
- data/src/liblwgeom/measures.c +861 -0
- data/src/liblwgeom/postgis_config.h +93 -0
- data/src/liblwgeom/ptarray.c +847 -0
- data/src/liblwgeom/vsprintf.c +179 -0
- data/src/liblwgeom/wktparse.h +126 -0
- data/src/liblwgeom/wktparse.lex +74 -0
- data/src/liblwgeom/wktparse.tab.c +2353 -0
- data/src/liblwgeom/wktparse.tab.h +145 -0
- data/src/liblwgeom/wktparse.y +385 -0
- data/src/libsqlite3_geocoder/Makefile +22 -0
- data/src/libsqlite3_geocoder/Makefile.nix +15 -0
- data/src/libsqlite3_geocoder/Makefile.redhat +15 -0
- data/src/libsqlite3_geocoder/extension.c +121 -0
- data/src/libsqlite3_geocoder/extension.h +13 -0
- data/src/libsqlite3_geocoder/levenshtein.c +42 -0
- data/src/libsqlite3_geocoder/metaphon.c +278 -0
- data/src/libsqlite3_geocoder/util.c +37 -0
- data/src/libsqlite3_geocoder/wkb_compress.c +54 -0
- data/src/metaphone/Makefile +7 -0
- data/src/metaphone/README +49 -0
- data/src/metaphone/extension.c +37 -0
- data/src/metaphone/metaphon.c +251 -0
- data/src/shp2sqlite/Makefile +37 -0
- data/src/shp2sqlite/Makefile.nix +36 -0
- data/src/shp2sqlite/Makefile.redhat +35 -0
- data/src/shp2sqlite/dbfopen.c +1595 -0
- data/src/shp2sqlite/getopt.c +695 -0
- data/src/shp2sqlite/getopt.h +127 -0
- data/src/shp2sqlite/shapefil.h +500 -0
- data/src/shp2sqlite/shp2sqlite.c +1974 -0
- data/src/shp2sqlite/shpopen.c +1894 -0
- data/tests/address.rb +236 -0
- data/tests/benchmark.rb +20 -0
- data/tests/constants.rb +57 -0
- data/tests/data/address-sample.csv +52 -0
- data/tests/data/db-test.csv +57 -0
- data/tests/data/locations.csv +4 -0
- data/tests/database.rb +137 -0
- data/tests/generate.rb +34 -0
- data/tests/numbers.rb +46 -0
- data/tests/run.rb +11 -0
- metadata +237 -0
@@ -0,0 +1,145 @@
|
|
1
|
+
/* A Bison parser, made by GNU Bison 2.3. */
|
2
|
+
|
3
|
+
/* Skeleton interface for Bison's Yacc-like parsers in C
|
4
|
+
|
5
|
+
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
6
|
+
Free Software Foundation, Inc.
|
7
|
+
|
8
|
+
This program is free software; you can redistribute it and/or modify
|
9
|
+
it under the terms of the GNU General Public License as published by
|
10
|
+
the Free Software Foundation; either version 2, or (at your option)
|
11
|
+
any later version.
|
12
|
+
|
13
|
+
This program is distributed in the hope that it will be useful,
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
GNU General Public License for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License
|
19
|
+
along with this program; if not, write to the Free Software
|
20
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
21
|
+
Boston, MA 02110-1301, USA. */
|
22
|
+
|
23
|
+
/* As a special exception, you may create a larger work that contains
|
24
|
+
part or all of the Bison parser skeleton and distribute that work
|
25
|
+
under terms of your choice, so long as that work isn't itself a
|
26
|
+
parser generator using the skeleton or a modified version thereof
|
27
|
+
as a parser skeleton. Alternatively, if you modify or redistribute
|
28
|
+
the parser skeleton itself, you may (at your option) remove this
|
29
|
+
special exception, which will cause the skeleton and the resulting
|
30
|
+
Bison output files to be licensed under the GNU General Public
|
31
|
+
License without this special exception.
|
32
|
+
|
33
|
+
This special exception was added by the Free Software Foundation in
|
34
|
+
version 2.2 of Bison. */
|
35
|
+
|
36
|
+
/* Tokens. */
|
37
|
+
#ifndef YYTOKENTYPE
|
38
|
+
# define YYTOKENTYPE
|
39
|
+
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
40
|
+
know about them. */
|
41
|
+
enum yytokentype {
|
42
|
+
POINT = 258,
|
43
|
+
LINESTRING = 259,
|
44
|
+
POLYGON = 260,
|
45
|
+
MULTIPOINT = 261,
|
46
|
+
MULTILINESTRING = 262,
|
47
|
+
MULTIPOLYGON = 263,
|
48
|
+
GEOMETRYCOLLECTION = 264,
|
49
|
+
CIRCULARSTRING = 265,
|
50
|
+
COMPOUNDCURVE = 266,
|
51
|
+
CURVEPOLYGON = 267,
|
52
|
+
MULTICURVE = 268,
|
53
|
+
MULTISURFACE = 269,
|
54
|
+
POINTM = 270,
|
55
|
+
LINESTRINGM = 271,
|
56
|
+
POLYGONM = 272,
|
57
|
+
MULTIPOINTM = 273,
|
58
|
+
MULTILINESTRINGM = 274,
|
59
|
+
MULTIPOLYGONM = 275,
|
60
|
+
GEOMETRYCOLLECTIONM = 276,
|
61
|
+
CIRCULARSTRINGM = 277,
|
62
|
+
COMPOUNDCURVEM = 278,
|
63
|
+
CURVEPOLYGONM = 279,
|
64
|
+
MULTICURVEM = 280,
|
65
|
+
MULTISURFACEM = 281,
|
66
|
+
SRID = 282,
|
67
|
+
EMPTY = 283,
|
68
|
+
VALUE = 284,
|
69
|
+
LPAREN = 285,
|
70
|
+
RPAREN = 286,
|
71
|
+
COMMA = 287,
|
72
|
+
EQUALS = 288,
|
73
|
+
SEMICOLON = 289,
|
74
|
+
WKB = 290
|
75
|
+
};
|
76
|
+
#endif
|
77
|
+
/* Tokens. */
|
78
|
+
#define POINT 258
|
79
|
+
#define LINESTRING 259
|
80
|
+
#define POLYGON 260
|
81
|
+
#define MULTIPOINT 261
|
82
|
+
#define MULTILINESTRING 262
|
83
|
+
#define MULTIPOLYGON 263
|
84
|
+
#define GEOMETRYCOLLECTION 264
|
85
|
+
#define CIRCULARSTRING 265
|
86
|
+
#define COMPOUNDCURVE 266
|
87
|
+
#define CURVEPOLYGON 267
|
88
|
+
#define MULTICURVE 268
|
89
|
+
#define MULTISURFACE 269
|
90
|
+
#define POINTM 270
|
91
|
+
#define LINESTRINGM 271
|
92
|
+
#define POLYGONM 272
|
93
|
+
#define MULTIPOINTM 273
|
94
|
+
#define MULTILINESTRINGM 274
|
95
|
+
#define MULTIPOLYGONM 275
|
96
|
+
#define GEOMETRYCOLLECTIONM 276
|
97
|
+
#define CIRCULARSTRINGM 277
|
98
|
+
#define COMPOUNDCURVEM 278
|
99
|
+
#define CURVEPOLYGONM 279
|
100
|
+
#define MULTICURVEM 280
|
101
|
+
#define MULTISURFACEM 281
|
102
|
+
#define SRID 282
|
103
|
+
#define EMPTY 283
|
104
|
+
#define VALUE 284
|
105
|
+
#define LPAREN 285
|
106
|
+
#define RPAREN 286
|
107
|
+
#define COMMA 287
|
108
|
+
#define EQUALS 288
|
109
|
+
#define SEMICOLON 289
|
110
|
+
#define WKB 290
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
116
|
+
typedef union YYSTYPE
|
117
|
+
#line 22 "wktparse.y"
|
118
|
+
{
|
119
|
+
double value;
|
120
|
+
const char* wkb;
|
121
|
+
}
|
122
|
+
/* Line 1489 of yacc.c. */
|
123
|
+
#line 124 "y.tab.h"
|
124
|
+
YYSTYPE;
|
125
|
+
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
126
|
+
# define YYSTYPE_IS_DECLARED 1
|
127
|
+
# define YYSTYPE_IS_TRIVIAL 1
|
128
|
+
#endif
|
129
|
+
|
130
|
+
extern YYSTYPE lwg_parse_yylval;
|
131
|
+
|
132
|
+
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
133
|
+
typedef struct YYLTYPE
|
134
|
+
{
|
135
|
+
int first_line;
|
136
|
+
int first_column;
|
137
|
+
int last_line;
|
138
|
+
int last_column;
|
139
|
+
} YYLTYPE;
|
140
|
+
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
|
141
|
+
# define YYLTYPE_IS_DECLARED 1
|
142
|
+
# define YYLTYPE_IS_TRIVIAL 1
|
143
|
+
#endif
|
144
|
+
|
145
|
+
extern YYLTYPE lwg_parse_yylloc;
|
@@ -0,0 +1,385 @@
|
|
1
|
+
/*
|
2
|
+
* Written by Ralph Mason ralph.mason<at>telogis.com
|
3
|
+
*
|
4
|
+
* Copyright Telogis 2004
|
5
|
+
* www.telogis.com
|
6
|
+
*
|
7
|
+
*/
|
8
|
+
|
9
|
+
%{
|
10
|
+
#include "wktparse.h"
|
11
|
+
#include <unistd.h>
|
12
|
+
#include <stdio.h>
|
13
|
+
|
14
|
+
void set_zm(char z, char m);
|
15
|
+
int lwg_parse_yylex(void);
|
16
|
+
%}
|
17
|
+
|
18
|
+
%start geometry
|
19
|
+
|
20
|
+
%locations
|
21
|
+
|
22
|
+
%union {
|
23
|
+
double value;
|
24
|
+
const char* wkb;
|
25
|
+
}
|
26
|
+
|
27
|
+
%token POINT LINESTRING POLYGON MULTIPOINT MULTILINESTRING MULTIPOLYGON GEOMETRYCOLLECTION CIRCULARSTRING COMPOUNDCURVE CURVEPOLYGON MULTICURVE MULTISURFACE
|
28
|
+
%token POINTM LINESTRINGM POLYGONM MULTIPOINTM MULTILINESTRINGM MULTIPOLYGONM GEOMETRYCOLLECTIONM CIRCULARSTRINGM COMPOUNDCURVEM CURVEPOLYGONM MULTICURVEM MULTISURFACEM
|
29
|
+
%token SRID
|
30
|
+
%token EMPTY
|
31
|
+
%token <value> VALUE
|
32
|
+
%token LPAREN RPAREN COMMA EQUALS SEMICOLON
|
33
|
+
%token <wkb> WKB
|
34
|
+
|
35
|
+
%%
|
36
|
+
|
37
|
+
geometry :
|
38
|
+
srid SEMICOLON { alloc_lwgeom(srid); } geometry_int
|
39
|
+
|
|
40
|
+
{ alloc_lwgeom(-1); } geometry_int
|
41
|
+
|
42
|
+
geometry_int :
|
43
|
+
geom_wkb
|
44
|
+
|
|
45
|
+
geom_point
|
46
|
+
|
|
47
|
+
geom_linestring
|
48
|
+
|
|
49
|
+
geom_circularstring
|
50
|
+
|
|
51
|
+
geom_polygon
|
52
|
+
|
|
53
|
+
geom_compoundcurve
|
54
|
+
|
|
55
|
+
geom_curvepolygon
|
56
|
+
|
|
57
|
+
geom_multipoint
|
58
|
+
|
|
59
|
+
geom_multilinestring
|
60
|
+
|
|
61
|
+
geom_multicurve
|
62
|
+
|
|
63
|
+
geom_multipolygon
|
64
|
+
|
|
65
|
+
geom_multisurface
|
66
|
+
|
|
67
|
+
geom_geometrycollection
|
68
|
+
|
69
|
+
srid :
|
70
|
+
SRID EQUALS VALUE { set_srid($3); }
|
71
|
+
|
72
|
+
geom_wkb :
|
73
|
+
WKB { alloc_wkb($1); }
|
74
|
+
|
75
|
+
|
76
|
+
/* POINT */
|
77
|
+
|
78
|
+
geom_point :
|
79
|
+
POINT point
|
80
|
+
|
|
81
|
+
POINTM { set_zm(0, 1); } point
|
82
|
+
|
83
|
+
point :
|
84
|
+
empty_point
|
85
|
+
|
|
86
|
+
nonempty_point
|
87
|
+
|
88
|
+
empty_point :
|
89
|
+
{ alloc_point(); } empty { pop(); }
|
90
|
+
|
91
|
+
nonempty_point :
|
92
|
+
{ alloc_point(); } point_int { pop(); }
|
93
|
+
|
94
|
+
point_int :
|
95
|
+
LPAREN a_point RPAREN
|
96
|
+
|
97
|
+
/* MULTIPOINT */
|
98
|
+
|
99
|
+
geom_multipoint :
|
100
|
+
MULTIPOINT { alloc_multipoint(); } multipoint { pop(); }
|
101
|
+
|
|
102
|
+
MULTIPOINTM { set_zm(0, 1); alloc_multipoint(); } multipoint {pop(); }
|
103
|
+
|
104
|
+
multipoint :
|
105
|
+
empty
|
106
|
+
|
|
107
|
+
{ alloc_counter(); } LPAREN multipoint_int RPAREN { pop(); }
|
108
|
+
|
109
|
+
multipoint_int :
|
110
|
+
mpoint_element
|
111
|
+
|
|
112
|
+
multipoint_int COMMA mpoint_element
|
113
|
+
|
114
|
+
mpoint_element :
|
115
|
+
nonempty_point
|
116
|
+
|
|
117
|
+
/* this is to allow MULTIPOINT(0 0, 1 1) */
|
118
|
+
{ alloc_point(); } a_point { pop(); }
|
119
|
+
|
120
|
+
|
121
|
+
/* LINESTRING */
|
122
|
+
|
123
|
+
geom_linestring :
|
124
|
+
LINESTRING linestring
|
125
|
+
|
|
126
|
+
LINESTRINGM { set_zm(0, 1); } linestring
|
127
|
+
|
128
|
+
linestring :
|
129
|
+
empty_linestring
|
130
|
+
|
|
131
|
+
nonempty_linestring
|
132
|
+
|
133
|
+
empty_linestring :
|
134
|
+
{ alloc_linestring(); } empty { pop(); }
|
135
|
+
|
136
|
+
nonempty_linestring :
|
137
|
+
{ alloc_linestring(); } linestring_1 { pop(); }
|
138
|
+
|
139
|
+
nonempty_linestring_closed :
|
140
|
+
{ alloc_linestring_closed(); } linestring_1 { pop(); }
|
141
|
+
|
142
|
+
linestring_1 :
|
143
|
+
{ alloc_counter(); } LPAREN linestring_int RPAREN { popc(); }
|
144
|
+
|
145
|
+
linestring_int :
|
146
|
+
a_point
|
147
|
+
|
|
148
|
+
linestring_int COMMA a_point;
|
149
|
+
|
150
|
+
/* CIRCULARSTRING */
|
151
|
+
|
152
|
+
geom_circularstring :
|
153
|
+
CIRCULARSTRING circularstring
|
154
|
+
|
|
155
|
+
CIRCULARSTRINGM {set_zm(0, 1); } circularstring
|
156
|
+
|
157
|
+
geom_circularstring_closed :
|
158
|
+
CIRCULARSTRING circularstring_closed
|
159
|
+
|
|
160
|
+
CIRCULARSTRINGM {set_zm(0, 1); } circularstring_closed
|
161
|
+
|
162
|
+
circularstring :
|
163
|
+
empty_circularstring
|
164
|
+
|
|
165
|
+
nonempty_circularstring
|
166
|
+
|
167
|
+
circularstring_closed :
|
168
|
+
empty_circularstring
|
169
|
+
|
|
170
|
+
nonempty_circularstring_closed
|
171
|
+
|
172
|
+
empty_circularstring :
|
173
|
+
{ alloc_circularstring(); } empty { pop(); }
|
174
|
+
|
175
|
+
nonempty_circularstring :
|
176
|
+
{ alloc_circularstring(); } circularstring_1 { pop(); }
|
177
|
+
|
178
|
+
nonempty_circularstring_closed :
|
179
|
+
{ alloc_circularstring_closed(); } circularstring_1 { pop(); }
|
180
|
+
|
181
|
+
circularstring_1 :
|
182
|
+
{ alloc_counter(); } LPAREN circularstring_int RPAREN { popc(); }
|
183
|
+
|
184
|
+
circularstring_int :
|
185
|
+
a_point
|
186
|
+
|
|
187
|
+
circularstring_int COMMA a_point;
|
188
|
+
|
189
|
+
/* COMPOUNDCURVE */
|
190
|
+
|
191
|
+
geom_compoundcurve:
|
192
|
+
COMPOUNDCURVE { alloc_compoundcurve(); } compoundcurve { pop(); }
|
193
|
+
|
|
194
|
+
COMPOUNDCURVEM {set_zm(0, 1); alloc_compoundcurve(); } compoundcurve { pop(); }
|
195
|
+
|
196
|
+
compoundcurve:
|
197
|
+
empty
|
198
|
+
|
|
199
|
+
{ alloc_counter(); } LPAREN compoundcurve_int RPAREN { pop(); }
|
200
|
+
|
201
|
+
compoundcurve_int:
|
202
|
+
nonempty_linestring
|
203
|
+
|
|
204
|
+
geom_circularstring
|
205
|
+
|
|
206
|
+
compoundcurve_int COMMA nonempty_linestring
|
207
|
+
|
|
208
|
+
compoundcurve_int COMMA geom_circularstring
|
209
|
+
|
210
|
+
/* MULTILINESTRING */
|
211
|
+
|
212
|
+
geom_multilinestring :
|
213
|
+
MULTILINESTRING { alloc_multilinestring(); }
|
214
|
+
multilinestring { pop(); }
|
215
|
+
|
|
216
|
+
MULTILINESTRINGM { set_zm(0, 1); alloc_multilinestring(); }
|
217
|
+
multilinestring { pop(); }
|
218
|
+
|
219
|
+
multilinestring :
|
220
|
+
empty
|
221
|
+
|
|
222
|
+
{ alloc_counter(); } LPAREN multilinestring_int RPAREN{ pop();}
|
223
|
+
|
224
|
+
multilinestring_int :
|
225
|
+
nonempty_linestring
|
226
|
+
|
|
227
|
+
multilinestring_int COMMA nonempty_linestring
|
228
|
+
|
229
|
+
/* MULTICURVESTRING */
|
230
|
+
|
231
|
+
geom_multicurve :
|
232
|
+
MULTICURVE { alloc_multicurve(); }
|
233
|
+
multicurve { pop(); }
|
234
|
+
|
|
235
|
+
MULTICURVEM { set_zm(0, 1); alloc_multicurve(); }
|
236
|
+
multicurve { pop(); }
|
237
|
+
|
238
|
+
multicurve :
|
239
|
+
empty
|
240
|
+
|
|
241
|
+
{ alloc_counter(); } LPAREN multicurve_int RPAREN { pop(); }
|
242
|
+
|
243
|
+
multicurve_int :
|
244
|
+
nonempty_linestring
|
245
|
+
|
|
246
|
+
geom_circularstring
|
247
|
+
|
|
248
|
+
multicurve_int COMMA nonempty_linestring
|
249
|
+
|
|
250
|
+
multicurve_int COMMA geom_circularstring
|
251
|
+
|
252
|
+
/* POLYGON */
|
253
|
+
|
254
|
+
geom_polygon :
|
255
|
+
POLYGON polygon
|
256
|
+
|
|
257
|
+
POLYGONM { set_zm(0, 1); } polygon
|
258
|
+
|
259
|
+
polygon :
|
260
|
+
empty_polygon
|
261
|
+
|
|
262
|
+
nonempty_polygon
|
263
|
+
|
264
|
+
empty_polygon :
|
265
|
+
{ alloc_polygon(); } empty { pop(); }
|
266
|
+
|
267
|
+
nonempty_polygon :
|
268
|
+
{ alloc_polygon(); } polygon_1 { pop(); }
|
269
|
+
|
270
|
+
polygon_1 :
|
271
|
+
{ alloc_counter(); } LPAREN polygon_int RPAREN { pop();}
|
272
|
+
|
273
|
+
polygon_int :
|
274
|
+
linestring_1
|
275
|
+
|
|
276
|
+
polygon_int COMMA linestring_1
|
277
|
+
|
278
|
+
/* CURVEPOLYGON */
|
279
|
+
|
280
|
+
geom_curvepolygon :
|
281
|
+
CURVEPOLYGON { alloc_curvepolygon(); } curvepolygon { pop(); }
|
282
|
+
|
|
283
|
+
CURVEPOLYGONM { set_zm(0, 1); alloc_curvepolygon(); }
|
284
|
+
curvepolygon { pop(); }
|
285
|
+
|
286
|
+
curvepolygon :
|
287
|
+
empty
|
288
|
+
|
|
289
|
+
{ alloc_counter(); } LPAREN curvepolygon_int RPAREN { pop(); }
|
290
|
+
|
291
|
+
curvepolygon_int :
|
292
|
+
nonempty_linestring_closed
|
293
|
+
|
|
294
|
+
geom_circularstring_closed
|
295
|
+
|
|
296
|
+
curvepolygon_int COMMA nonempty_linestring_closed
|
297
|
+
|
|
298
|
+
curvepolygon_int COMMA geom_circularstring_closed
|
299
|
+
|
300
|
+
/* MULTIPOLYGON */
|
301
|
+
|
302
|
+
geom_multipolygon :
|
303
|
+
MULTIPOLYGON { alloc_multipolygon(); } multipolygon { pop(); }
|
304
|
+
|
|
305
|
+
MULTIPOLYGONM { set_zm(0, 1); alloc_multipolygon(); }
|
306
|
+
multipolygon { pop();}
|
307
|
+
|
308
|
+
multipolygon :
|
309
|
+
empty
|
310
|
+
|
|
311
|
+
{ alloc_counter(); } LPAREN multipolygon_int RPAREN { pop(); }
|
312
|
+
|
313
|
+
multipolygon_int :
|
314
|
+
nonempty_polygon
|
315
|
+
|
|
316
|
+
multipolygon_int COMMA nonempty_polygon
|
317
|
+
|
318
|
+
/* MULTISURFACE */
|
319
|
+
|
320
|
+
geom_multisurface :
|
321
|
+
MULTISURFACE {alloc_multisurface(); } multisurface { pop(); }
|
322
|
+
|
|
323
|
+
MULTISURFACEM { set_zm(0, 1); alloc_multisurface(); }
|
324
|
+
multisurface { pop(); }
|
325
|
+
|
326
|
+
multisurface :
|
327
|
+
empty
|
328
|
+
|
|
329
|
+
{ alloc_counter(); } LPAREN multisurface_int RPAREN { pop(); }
|
330
|
+
|
331
|
+
multisurface_int :
|
332
|
+
nonempty_polygon
|
333
|
+
|
|
334
|
+
geom_curvepolygon
|
335
|
+
|
|
336
|
+
multisurface_int COMMA nonempty_polygon
|
337
|
+
|
|
338
|
+
multisurface_int COMMA geom_curvepolygon
|
339
|
+
|
340
|
+
/* GEOMETRYCOLLECTION */
|
341
|
+
|
342
|
+
geom_geometrycollection :
|
343
|
+
GEOMETRYCOLLECTION { alloc_geomertycollection(); }
|
344
|
+
geometrycollection { pop(); }
|
345
|
+
|
|
346
|
+
GEOMETRYCOLLECTIONM { set_zm(0, 1); alloc_geomertycollection(); }
|
347
|
+
geometrycollection { pop();}
|
348
|
+
|
349
|
+
geometrycollection :
|
350
|
+
empty
|
351
|
+
|
|
352
|
+
{ alloc_counter(); } LPAREN geometrycollection_int RPAREN { pop(); }
|
353
|
+
|
354
|
+
geometrycollection_int :
|
355
|
+
/* to support GEOMETRYCOLLECTION(EMPTY) for backward compatibility */
|
356
|
+
empty
|
357
|
+
|
|
358
|
+
geometry_int
|
359
|
+
|
|
360
|
+
geometrycollection_int COMMA geometry_int
|
361
|
+
|
362
|
+
|
363
|
+
a_point :
|
364
|
+
point_2d
|
365
|
+
|
|
366
|
+
point_3d
|
367
|
+
|
|
368
|
+
point_4d
|
369
|
+
|
370
|
+
point_2d :
|
371
|
+
VALUE VALUE {alloc_point_2d($1,$2); }
|
372
|
+
|
373
|
+
point_3d :
|
374
|
+
VALUE VALUE VALUE {alloc_point_3d($1,$2,$3); }
|
375
|
+
|
376
|
+
point_4d :
|
377
|
+
VALUE VALUE VALUE VALUE {alloc_point_4d($1,$2,$3,$4); }
|
378
|
+
|
379
|
+
empty :
|
380
|
+
EMPTY { alloc_empty(); }
|
381
|
+
%%
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|