<div dir="ltr"><div>$B$+$d$^$G$9(B</div><div><br></div><div>$B0J2<$N$h$&$J%3!<%I$,$"$j$^$7$?$,!"$3$&$$$&$3$H$J$N$G$7$g$&$+!)(B</div><div><br></div><a href="http://www.prefield.com/algorithm/geometry/isconvex.html">http://www.prefield.com/algorithm/geometry/isconvex.html</a><br>
<div><br></div><div><br></div><div>$B$"$H$OA4D:E@$rM?$($F(BConvexful$B$r$+$1$F$G$-$?%]%j%4%s$HHf3S$9$k$H$+(B.....</div><div>$B$A$g$$$H8!>Z$7$F$k;~4V$,$J$$$N$G!"$J$s$+$_$D$1$k$-$C$+$1$K$J$i$s$+$H$$$&>pJsDs6!$G$9(B</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
2013$BG/(B9$B7n(B15$BF|(B 12:43 Hiroshi Miura(@osmf) <span dir="ltr"><<a href="mailto:miurahr@osmf.jp" target="_blank">miurahr@osmf.jp</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
OSMFJ$B!!;01:$G$9!#(B<br>
<br>
<br>
$B$A$g$C$H$7$?OCBj$rDs6!$9$k$H6&$K!"$d$j$+$?$,@5$7$$$N$+$I$&$+$NAjCL$r(B<br>
GIS$B$N@lLg$N3'MM$K$5$;$F$[$7$$$G$9(B<br>
<br>
<br>
$B!c7P0^!d(B<br>
$BJ,;6%?%$%k%5!<%P$r<B8=$9$k(BTileMan(*1)$B%W%m%8%'%/%H$G!"(B<br>
 lua-nginx-osm $B%i%$%V%i%j(B(*2)$B$H$$$&$N$r!"%3%"%i%$%V%i%j$H$7$F3+H/$7$F$$$^$9!#(B<br>
TileMan$B$N5!G=$K$D$$$F$O!"(BState of the Map 2013(*3)$B$N%W%l%<%s$r;2>H$/$@$5$$!#(B<br>
#$B4XO"(BURL$B$OKvHx$K$"$j$^$9(B<br>
<br>
$B$3$NCf$G!"<!$N$h$&$J5!G=$r<B8=$7$F$$$^$9!#(B<br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30@Q$r$H$C$F$*$j!"A4$F$NJU$K$D$$$FH=Dj$7$F!"$9$Y$FIi$G$J$1$l$P!"(B<br>
$B$9$Y$F$NJU$NFbB&$K!"H=Dj$9$k%?%$%kMW5a$N0LCV$,$"$k$3$H$,J,$+$j$^$9!#(B<br>
<br>
$B$7$+$7!"$3$NH=Dj%m%8%C%/$K$O!"<eE@$,$"$j!"Hf3S$9$k%]%j%4%s$O!"$+$J$i$:(B<br>
convex polygon ($BFLB?3Q7A!K$G$"$kI,MW$,$"$k$N$G$9!#(B<br>
<br>
<br>
$B!cK\Bj!d(B<br>
$B$=$3$G!"$?$H$($P(B japan.kml (*7)$B$N$h$&$J1zFLB?3Q7A(B(concave polygon)$B$rFLB?LLBN$KJ,3d$9$k$3$H$K$7$^$7$?!#(B<br>
$BC1=c$J%1!<%9$G$O!"<j:n6H$G$b2DG=$G$9$,!"J#;($K$J$k$H!"<j:n6H$G$OIT2DG=$K$J$j$^$9!#(B<br>
<br>
$B$3$N$h$&$JLdBj$O!"7W;;4v2?3X$G8&5f$5$l$F$$$F!"AG@2$i$7$$%i%$%V%i%j$,$9$G$KDs6!$5$l$F$$$^$9!#(B<br>
$B$=$3$G!"(BCGAL$B$rMQ$$$F!"%]%j%4%s$rJ#?t$NB?3Q7A$KJQ49$7!"(BLUA$B$N%W%m%0%i%`$r@8@.$9$k$h$&$J%f!<%F%#%j%F%#%W%m%0%i%`(B<br>
(*9)$B$r=q$/$3$H$K$7$^$7$?!#!J(BGEOS$B$K$O!"3:Ev5!G=$,$J$$$_$?$$$G$7$?!K(B<br>
<br>
$B<B:]$K?($C$F$_$?$$J}$O!"$D$.$N$h$&$K$*4j$$$7$^$9(B<br>
<br>
$ git clone <a href="https://github.com/miurahr/lua-nginx-osm.git" target="_blank">https://github.com/miurahr/lua-nginx-osm.git</a><br>
$ cd lua-nginx-osm<br>
$ apt-get install libcgal-dev cmake make<br>
$ make<br>
<br>
$B$3$l$G%W%m%0%i%`$,@8@.$5$l$k$O$:$G$9!#<B9T$O!"(B<br>
<br>
$ utils/poly2lua/poly2lua -t<br>
<br>
$B$3$3$G(B(-t)$B$r$D$1$k$H!"%F%9%H%b!<%I$G!"FbB"$NF|K\$NDj5A%G!<%?$r85$K!"J#?t$NB?3Q7A!J0^EY7PEY!K$r<($9%G!<%?$r@8@.$7$^$9!#(B<br>
$B$^$?!"(Bosm/data/*.kml $B$,85%G!<%?$G!"(B osm/data/*.lua$B$,@8@.$5$l$?J#?t$NFLB?3Q7A$N%G!<%?$G$9!#(B<br>
<br>
$B%i%$%V%i%j$,(BC++$BMQ$J$N$G!"(BC++$B$G%5%s%W%k%W%m%0%i%`$r;29M$K=q$$$?$G$9$,!"(B<br>
$B=PMh$,0-$$$+$b$7$l$^$;$s!#(B<br>
<br>
$B!y(B<br>
$B!y!!$G!"$3$3$G<ALd$G$9$,!"$I$&$d$C$?$i!"$3$N@8@.$5$l$?%G!<%?$,@5$7$/FLB?3Q7A$G$"$k$3$H$,$o$+$k$G$7$g$&$+!)(B<br>
$B!y(B<br>
<br>
$BK\7o$O!"%V%m%0$K$+$-$^$7$?(B(*11)<br>
------------------<br>
$B!J!v#1!K(B<a href="https://github.com/osmfj/tileman" target="_blank">https://github.com/osmfj/tileman</a><br>
$B!J!v(B2$B!K(B<a href="https://github.com/miurahr/lua-nginx-osm" target="_blank">https://github.com/miurahr/lua-nginx-osm</a><br>
(*3) <a href="http://miurahr.github.io/2013-0908-tileman.html#/title" target="_blank">http://miurahr.github.io/2013-0908-tileman.html#/title</a><br>
(*4)<a href="http://download.geofabrik.de/asia/japan.html" target="_blank">http://download.geofabrik.de/asia/japan.html</a><br>
(*5)<a href="https://github.com/osmfj/tileman/blob/master/doc/typical_configuration.png" target="_blank">https://github.com/osmfj/tileman/blob/master/doc/typical_configuration.png</a><br>
$B!J!v#6!K(B<a href="https://github.com/miurahr/lua-nginx-osm/blob/master/osm" target="_blank">https://github.com/miurahr/lua-nginx-osm/blob/master/osm</a> /tile.lua#L81<br>
(*7)<a href="https://github.com/miurahr/lua-nginx-osm/blob/master/osm/data/japan.kml" target="_blank">https://github.com/miurahr/lua-nginx-osm/blob/master/osm/data/japan.kml</a><br>
(*8) <a href="http://www.cgal.org/" target="_blank">http://www.cgal.org/</a><br>
(*9)<a href="https://github.com/miurahr/lua-nginx-osm/blob/master/utils/poly2lua.cpp" target="_blank">https://github.com/miurahr/lua-nginx-osm/blob/master/utils/poly2lua.cpp</a><br>
(*10)<a href="https://github.com/miurahr/lua-nginx-osm/blob/master/utils/kml2poly.py" target="_blank">https://github.com/miurahr/lua-nginx-osm/blob/master/utils/kml2poly.py</a><br>
(*11)<a href="http://blogs.da-cha.jp/momokuri.php/title-71" target="_blank">http://blogs.da-cha.jp/momokuri.php/title-71</a><br>
_______________________________________________<br>
OSGeoJapan-discuss mailing list<br>
<a href="mailto:OSGeoJapan-discuss@lists.osgeo.org">OSGeoJapan-discuss@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/osgeojapan-discuss" target="_blank">http://lists.osgeo.org/mailman/listinfo/osgeojapan-discuss</a><br>
</blockquote></div><br></div>