function LonLat = getRSPLonLat(sectransCombined)
%GETRSPLONLAT  Get the lon/lat coordinates from the jarkus RSP positions.
%
%   Get the lon/lat coordinates from the jarkus RSP positions. The RSP
%   postion is the origin of the jarkus transects, being 0m.
%
%   Syntax:
%   LonLat = getRSPLonLat(sectransCombined)
%
%   Input:
%      sectransCombined  = the ordering numbers of the available sections
%                          and transects are combined to one number
%
%   Output:
%      LonLat            = the LonLat coordinates of the RSP position on
%                          the jarkus transects
%
%   Example
%
%   See also 

%% Copyright notice
%   --------------------------------------------------------------------
%   Copyright (C) 2010 <COMPANY>
%       Lou Verhage
%
%       <lou.verhage@deltares.nl>	
%
%       <ADDRESS>
%
%   This library is free software: you can redistribute it and/or
%   modify it under the terms of the GNU Lesser General Public
%   License as published by the Free Software Foundation, either
%   version 2.1 of the License, or (at your option) any later version.
%
%   This library is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%   Lesser General Public License for more details.
%
%   You should have received a copy of the GNU Lesser General Public
%   License along with this library. If not, see <http://www.gnu.org/licenses/>.
%   --------------------------------------------------------------------

% This tool is part of <a href="http://OpenEarth.nl">OpenEarthTools</a>.
% OpenEarthTools is an online collaboration to share and manage data and 
% programming tools in an open source, version controlled environment.
% Sign up to recieve regular updates of this function, and to contribute 
% your own tools.

%% Version <http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html>
% Created: 18 Mar 2010
% Created with Matlab version: 7.8.0.347 (R2009a)

% $Id: getRSPLonLat.m 4926 2011-04-18 13:00:40Z verhage $
% $Date: 2011-04-18 15:00:40 +0200 (Mon, 18 Apr 2011) $
% $Author: verhage $
% $Revision: 4926 $
% $HeadURL: https://svn.oss.deltares.nl/repos/openearthrawdata/trunk/rijkswaterstaat/kustlijnkaartenboek/scripts/getRSPLonLat.m $
% $Keywords: $

%% Initialize

RSP    = zeros(length(sectransCombined),1);

sec    = floor(sectransCombined / 1.e6);
Trans  = sectransCombined - sec * 1.e6;

%% compute
[x,y]     = jarkus_rsp2xy(RSP,sec,Trans); % jarkus_rsp2xy
[Lon,Lat] = convertCoordinates(x,y,'CS1.name','Amersfoort / RD New','CS2.name','WGS 84','CS2.type','geo');

LonLat.Lon = Lon;
LonLat.Lat = Lat;

[x,y]     = jarkus_rsp2xy(800.,sec,Trans); % jarkus_rsp2xy
[Lon,Lat] = convertCoordinates(x,y,'CS1.name','Amersfoort / RD New','CS2.name','WGS 84','CS2.type','geo');
LonLat.jarkus.Lon = Lon;
LonLat.jarkus.Lat = Lat;

