Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rename everything from erlgeos to erlgeom.

  • Loading branch information...
commit d0fabba2b073c7a933eff44a7829ee2d4c8b32a4 1 parent 3431534
Volker Mische vmx authored
12 README.md
View
@@ -2,24 +2,24 @@ Compile the C and Erlang file:
./rebar compile
-Here's an example session in the erlang shell. See the erlgeos.erl file for
+Here's an example session in the erlang shell. See the src/erlgeom.erl file for
more examples.
$ erl -pa ebin
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false]
Eshell V5.8.4 (abort with ^G)
- 1> Geom1 = erlgeos:to_geom({'Point',[5,5]}).
+ 1> Geom1 = erlgeom:to_geom({'Point',[5,5]}).
geom: POINT (5.0000000000000000 5.0000000000000000)
<<>>
- 2> Geom2 = erlgeos:to_geom({'LineString', [[1,1],[14,14]]}).
+ 2> Geom2 = erlgeom:to_geom({'LineString', [[1,1],[14,14]]}).
geom: LINESTRING (1.0000000000000000 1.0000000000000000, 14.0000000000000000 14.0000000000000000)
<<>>
- 3> erlgeos:disjoint(Geom1, Geom2).
+ 3> erlgeom:disjoint(Geom1, Geom2).
false
- 4> Geom3 = erlgeos:to_geom({'Point', [2.5,65.7]}).
+ 4> Geom3 = erlgeom:to_geom({'Point', [2.5,65.7]}).
geom: POINT (2.5000000000000000 65.7000000000000028)
<<>>
- 5> erlgeos:disjoint(Geom1, Geom3).
+ 5> erlgeom:disjoint(Geom1, Geom3).
true
6>
2  c_src/erlgeos.c → c_src/erlgeom.c
View
@@ -552,4 +552,4 @@ static ErlNifFunc nif_funcs[] =
{"from_geom", 1, from_geom}
};
-ERL_NIF_INIT(erlgeos, nif_funcs, &load, NULL, NULL, unload);
+ERL_NIF_INIT(erlgeom, nif_funcs, &load, NULL, NULL, unload);
4 ebin/erlgeos.app → ebin/erlgeom.app
View
@@ -1,7 +1,7 @@
-{application, erlgeos, [
+{application, erlgeom, [
{description, "Erlgeom - Erlang binding for geometry libraries"},
{vsn, "0.1.0"},
- {modules, [erlgeos]},
+ {modules, [erlgeom]},
{registered, []},
{applications, [kernel, stdlib]},
{env, []}
2  rebar.config
View
@@ -4,7 +4,7 @@
{port_sources, ["c_src/*.c"]}.
-{so_name, "erlgeos.so"}.
+{so_name, "erlgeom.so"}.
{port_envs, [
% Link the GEOS C binding
50 src/erlgeos.erl → src/erlgeom.erl
View
@@ -12,7 +12,7 @@
% License for the specific language governing permissions and limitations under
% the License.
--module(erlgeos).
+-module(erlgeom).
-export([init/0, hello/0, disjoint/2, from_geom/1, to_geom/1,
topology_preserve_simplify/2]).
@@ -22,19 +22,17 @@
-on_load(init/0).
-%init() ->
-% erlang:load_nif("/home/vmx/src/couchbase/erlgeom/erlgeos", 0).
init() ->
SoName = case code:priv_dir(?MODULE) of
{error, bad_name} ->
case filelib:is_dir(filename:join(["..", "priv"])) of
true ->
- filename:join(["..", "priv", "erlgeos"]);
+ filename:join(["..", "priv", "erlgeom"]);
false ->
- filename:join(["priv", "erlgeos"])
+ filename:join(["priv", "erlgeom"])
end;
Dir ->
- filename:join(Dir, "erlgeos")
+ filename:join(Dir, "erlgeom")
end,
(catch erlang:load_nif(SoName, 0)).
@@ -71,52 +69,52 @@ test() ->
point() ->
Pt = {'Point',[0.0, 1.1]},
- Pt1 = erlgeos:to_geom(Pt),
- Pt = erlgeos:from_geom(Pt1).
+ Pt1 = erlgeom:to_geom(Pt),
+ Pt = erlgeom:from_geom(Pt1).
multipoint() ->
Mp = {'MultiPoint', [[1.0,1.0],[5.0,5.0]]},
- Mp1 = erlgeos:to_geom(Mp),
- Mp = erlgeos:from_geom(Mp1),
+ Mp1 = erlgeom:to_geom(Mp),
+ Mp = erlgeom:from_geom(Mp1),
Mp2 = {'MultiPoint', [[1.0,1.0],[5.0,5.0],[23.42,592.13],[98.2,40.2]]},
- Mp3 = erlgeos:to_geom(Mp2),
- Mp2 = erlgeos:from_geom(Mp3).
+ Mp3 = erlgeom:to_geom(Mp2),
+ Mp2 = erlgeom:from_geom(Mp3).
linestring() ->
Ls = {'LineString', [[1.0,1.0],[5.0,5.0],[23.42,592.13],[98.2,40.2]]},
- Ls1 = erlgeos:to_geom(Ls),
- Ls = erlgeos:from_geom(Ls1).
+ Ls1 = erlgeom:to_geom(Ls),
+ Ls = erlgeom:from_geom(Ls1).
multilinestring() ->
Ml = {'MultiLineString', [[[5.2,6.3],[70.5,58.7],[0.1,20.55],[5.2,6.3]], [[10.0,20.1],[10.1,20.4],[9.8,20.2],[10.0,20.1]]]},
- Ml1 = erlgeos:to_geom(Ml),
- Ml = erlgeos:from_geom(Ml1).
+ Ml1 = erlgeom:to_geom(Ml),
+ Ml = erlgeom:from_geom(Ml1).
polygon() ->
Py = {'Polygon', [[[5.2,6.3],[70.5,58.7],[0.1,20.55],[5.2,6.3]], [[10.0,20.1],[10.1,20.4],[9.8,20.2],[10.0,20.1]]]},
- Py1 = erlgeos:to_geom(Py),
- Py = erlgeos:from_geom(Py1).
+ Py1 = erlgeom:to_geom(Py),
+ Py = erlgeom:from_geom(Py1).
multipolygon() ->
% From GeoJSON spec
My = {'MultiPolygon',[[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],[[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]]},
- My1 = erlgeos:to_geom(My),
- My = erlgeos:from_geom(My1).
+ My1 = erlgeom:to_geom(My),
+ My = erlgeom:from_geom(My1).
geometrycollection() ->
% From GeoJSON spec
Gc = {'GeometryCollection',[{'Point',[100.0, 0.0]},{'LineString',[[101.0, 0.0],[102.0, 1.0]]}]},
- Gc1 = erlgeos:to_geom(Gc),
- Gc = erlgeos:from_geom(Gc1).
+ Gc1 = erlgeom:to_geom(Gc),
+ Gc = erlgeom:from_geom(Gc1).
disjoint_test() ->
Pt = {'Point',[3.0, 3.0]},
Ls = {'LineString', [[1.0,1.0],[5.0,5.0]]},
- Pt1 = erlgeos:to_geom(Pt),
- Ls1 = erlgeos:to_geom(Ls),
- erlgeos:disjoint(Pt1, Ls1).
+ Pt1 = erlgeom:to_geom(Pt),
+ Ls1 = erlgeom:to_geom(Ls),
+ erlgeom:disjoint(Pt1, Ls1).
simplify_test() ->
Polygon = {'Polygon', [[[-43.59375, -0.3515625], [-31.640625, 15.8203125], [-33.046875, 25.6640625], [-37.265625, 39.7265625], [-34.453125, 67.8515625], [6.328125, 58.7109375], [21.09375, 65.0390625], [35.15625, 63.6328125], [78.046875, 63.6328125], [75.234375, 48.1640625], [65.390625, 33.3984375], [43.59375, 36.2109375], [-6.328125, 36.2109375], [-0.703125, 31.9921875], [2.109375, 5.9765625], [3.515625, -16.5234375], [-17.578125, -19.3359375], [-24.609375, -5.9765625], [-40.078125, -11.6015625], [-40.078125, -11.6015625], [-43.59375, -0.3515625]]]},
- erlgeos:topology_preserve_simplify(erlgeos:to_geom(Polygon), 30.0).
+ erlgeom:topology_preserve_simplify(erlgeom:to_geom(Polygon), 30.0).
Please sign in to comment.
Something went wrong with that request. Please try again.