Reproject (reproject v0.1.11)
Link to this section Summary
Functions
Create a projection. This returns {:ok, projection}
where projection
is an opaque pointer referring to a C struct
Create a projection from a WKT, like the one in the .prj component
of a shapefile. This returns the same thing as the create/1
function.
Create a projection from a WKT. This returns the same thing as the create/1
function.
Get the expanded projection definition
Get a name for the projection
Transform a point from source projection to dest projection
Link to this section Functions
create(b)
Create a projection. This returns {:ok, projection}
where projection
is an opaque pointer referring to a C struct
iex> {:ok, _} = Reproject.create("+init=epsg:4326")
create_from_prj(wkt)
Create a projection from a WKT, like the one in the .prj component
of a shapefile. This returns the same thing as the create/1
function.
iex> {:ok, _} = Reproject.create_from_wkt("GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433],AUTHORITY[\"EPSG\",4326]]")
create_from_wkt(wkt)
Create a projection from a WKT. This returns the same thing as the create/1
function.
iex> {:ok, _} = Reproject.create_from_wkt("GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433],AUTHORITY[\"EPSG\",4326]]")
do_create(_)
do_create_from_wkt(_, _, _)
expand(_)
Get the expanded projection definition
iex> {:ok, prj} = Reproject.create("+init=epsg:4326") iex> Reproject.expand(prj) " +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
get_projection_name(_)
Get a name for the projection
# iex> {:ok, prj} = Reproject.create_from_wkt("GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433],AUTHORITY[\"EPSG\",4326]]") # iex> Reproject.get_projection_name(prj) # "WGS 84"
init()
transform(src, dst, p)
transform_2d(_, _, _)
Transform a point from source projection to dest projection
iex> {:ok, wgs84} = Reproject.create("+init=epsg:4326") iex> {:ok, crs2180} = Reproject.create("+init=epsg:2180") iex> {:ok, {x, y}} = Reproject.transform(wgs84, crs2180, {21.049804687501, 52.22900390625}) iex> {is_number(x), is_number(y)} {true, true}