working with geometries
This commit is contained in:
parent
4b6c43406f
commit
93d0dba307
5
Makefile
5
Makefile
@ -21,6 +21,7 @@ FIGURES = test-figures \
|
||||
selfcrossing-1-before \
|
||||
selfcrossing-1-after
|
||||
|
||||
# paper sizes in mm
|
||||
A4p = 210x297
|
||||
A4l = 297x210
|
||||
A5p = 148x210
|
||||
@ -31,6 +32,10 @@ A7p = 74x105
|
||||
A7l = 105x74
|
||||
A8p = 52x74
|
||||
A8l = 74x52
|
||||
# interesting scales:
|
||||
# - 1:10000 (GDR10)
|
||||
# - 1:50000 (GDR50)
|
||||
# - 1:250000 (GDR250)
|
||||
|
||||
#################################
|
||||
# The thesis, publishable version
|
||||
|
@ -10,7 +10,7 @@ from matplotlib import rc
|
||||
CMAP = 'tab20c'
|
||||
|
||||
BOUNDS = ('xmin', 'ymin', 'xmax', 'ymax')
|
||||
INCH_MM = 25.4 # mm
|
||||
INCH_MM = 25.4
|
||||
BLACK, GREEN, ORANGE, PURPLE = '#000000', '#1b9e77', '#d95f02', '#7570b3'
|
||||
PSQL_CREDS = "host=127.0.0.1 dbname=osm user=osm password=osm"
|
||||
|
||||
|
@ -85,7 +85,7 @@ Current open-source line generalization solutions have their roots in
|
||||
NOTICE: this value should be copied to layer2img.py:TEXTWIDTH, so dimensions
|
||||
of inline images are reasonable.
|
||||
|
||||
Text width in cm: {\printinunitsof{cm}\prntlen{\textwidth}}
|
||||
textwidth in cm: {\printinunitsof{cm}\prntlen{\textwidth}}
|
||||
\fi
|
||||
|
||||
When creating small-scale maps, often the detail of the data source is greater
|
||||
@ -278,7 +278,7 @@ direction.
|
||||
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{test-figures}
|
||||
\includegraphics[width=\textwidth]{test-figures}
|
||||
\caption{Line geometries for automated test cases}
|
||||
\label{fig:test-figures}
|
||||
\end{figure}
|
||||
@ -340,7 +340,7 @@ but with bends colored as polygons: each color is a distinctive bend.
|
||||
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\includegraphics[width=\linewidth]{fig8-definition-of-a-bend}
|
||||
\includegraphics[width=\textwidth]{fig8-definition-of-a-bend}
|
||||
\caption{Originally Figure 8: detected bends are highlighted}
|
||||
\label{fig:fig8-definition-of-a-bend}
|
||||
\end{figure}
|
||||
|
16
tests.sql
16
tests.sql
@ -32,10 +32,10 @@ create table wm_figures (name text, way geometry);
|
||||
-- ogr2ogr -update -f PostgreSQL PG:"host=127.0.0.1 user=osm password=osm dbname=osm" fig8.gpkg
|
||||
-- to "normalize" a new line when it's in `f`:
|
||||
-- select st_astext(st_snaptogrid(st_transscale(geometry, -19.5, .016, 4000, 4000), 1)) from f;
|
||||
insert into wm_figures (name, way) values ('fig3',ST_GeomFromText('LINESTRING(0 0,12 0,13 4,20 2,20 0,32 0,33 10,38 16,43 15,44 10,44 0,60 0)'));
|
||||
insert into wm_figures (name, way) values ('fig3-1',ST_GeomFromText('LINESTRING(0 0,12 0,13 4,20 2,20 0,32 0,33 10,38 16,43 15,44 10,44 0)'));
|
||||
insert into wm_figures (name, way) values ('fig5',ST_GeomFromText('LINESTRING(0 39,19 52,27 77,26 104,41 115,49 115,65 103,65 75,53 45,63 15,91 0)'));
|
||||
insert into wm_figures (name, way) values ('fig6',ST_GeomFromText('LINESTRING(84 47,91 59,114 64,122 80,116 92,110 93,106 106,117 118,136 107,135 76,120 45,125 39,141 39,147 32)'));
|
||||
insert into wm_figures (name, way) values ('fig3','LINESTRING(0 0,12 0,13 4,20 2,20 0,32 0,33 10,38 16,43 15,44 10,44 0,60 0)'::geometry);
|
||||
insert into wm_figures (name, way) values ('fig3-1','LINESTRING(0 0,12 0,13 4,20 2,20 0,32 0,33 10,38 16,43 15,44 10,44 0)'::geometry);
|
||||
insert into wm_figures (name, way) values ('fig5','LINESTRING(0 39,19 52,27 77,26 104,41 115,49 115,65 103,65 75,53 45,63 15,91 0)'::geometry);
|
||||
insert into wm_figures (name, way) values ('fig6','LINESTRING(84 47,91 59,114 64,122 80,116 92,110 93,106 106,117 118,136 107,135 76,120 45,125 39,141 39,147 32)'::geometry);
|
||||
insert into wm_figures (name, way) values ('fig6-rev',ST_Reverse(ST_Translate((select way from wm_figures where name='fig6'), 60, 0)));
|
||||
insert into wm_figures (name, way) values ('fig6-combi',
|
||||
ST_Union(
|
||||
@ -43,12 +43,12 @@ insert into wm_figures (name, way) values ('fig6-combi',
|
||||
ST_Translate((select way from wm_figures where name='fig6'), 80, 90)
|
||||
)
|
||||
);
|
||||
insert into wm_figures (name, way) values('fig8', ST_GeomFromText('LINESTRING(173 12,174 10,180 8,186 8,186 13,191 11,189 6,201 5,203 11,216 16,216 6,222 7,229 3,236 2,239 6,243 8,248 6)'));
|
||||
insert into wm_figures (name, way) values ('inflection-1',ST_GeomFromText('LINESTRING(110 24,114 20,133 20,145 15,145 0,136 8,123 10,114 10,111 2)'));
|
||||
insert into wm_figures (name, way) values ('multi-island',ST_GeomFromText('MULTILINESTRING((-15 10,-10 10,-5 11,0 11,5 11,10 10,11 9,13 10,15 9),(-5 11,-2 15,0 16,2 15,5 11))'));
|
||||
insert into wm_figures (name, way) values('fig8', 'LINESTRING(173 12,174 10,180 8,186 8,186 13,191 11,189 6,201 5,203 11,216 16,216 6,222 7,229 3,236 2,239 6,243 8,248 6)'::geometry);
|
||||
insert into wm_figures (name, way) values ('inflection-1','LINESTRING(110 24,114 20,133 20,145 15,145 0,136 8,123 10,114 10,111 2)'::geometry);
|
||||
insert into wm_figures (name, way) values ('multi-island','MULTILINESTRING((-15 10,-10 10,-5 11,0 11,5 11,10 10,11 9,13 10,15 9),(-5 11,-2 15,0 16,2 15,5 11))'::geometry);
|
||||
|
||||
-- TODO: there is a bug and it does not go through `self_crossing` function.
|
||||
insert into wm_figures (name, way) values ('selfcrossing-1',ST_GeomFromText('LINESTRING(-27 180,-20 166,-21 142,-18 136,55 136,55 136,71 145,44 165,37 146,22 145,14 164,11 164,3 146,-12 146,-13 176,-18 184)'));
|
||||
insert into wm_figures (name, way) values ('selfcrossing-1','LINESTRING(-27 180,-20 166,-21 142,-18 136,55 136,55 136,71 145,44 165,37 146,22 145,14 164,11 164,3 146,-12 146,-13 176,-18 184)'::geometry);
|
||||
insert into wm_figures (name, way) values ('selfcrossing-1-rev',ST_Reverse(ST_Translate((select way from wm_figures where name='selfcrossing-1'), 0, 60)));
|
||||
|
||||
delete from wm_debug where name in (select distinct name from wm_figures);
|
||||
|
Loading…
Reference in New Issue
Block a user