<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA - Allan CORNET
 * 
 * This file is released into the public domain
 *
 -->
<refentry version="5.0-subset Scilab" xml:id="XY2rec" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:ns3="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:db="http://docbook.org/ns/docbook">
  <info>
    <pubdate>$LastChangedDate: 2013-10-17 12:00:00 +0100 (Thu., October 17, 2013)
    $</pubdate>
  </info>

  <refnamediv>
    <refname>XY2rec</refname>

    <refpurpose>Returns the record numbers of cells in a georeferenced grid, according to their XY coordinates.</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <title>Calling Sequence</title>

    <synopsis>C = XY2rec ( Header , XY )</synopsis>
  </refsynopsisdiv>


  <refsection>
    <title>Arguments</title>
    <variablelist>
	  
      <varlistentry>
      <term>Header</term>
        <listitem>
          <para>
	  Vector of 7 elements describing the grid georeferencing (as returned by <literal>GetFloatRasterHeader</literal> or <literal>GetFlowDirGridHeader</literal>) : number of columns, number of lines, cellsize, X coordinate of lower-left pixel, Y coordinate of lower-left pixel, NODATA value, convention for positioning the lower-left pixel.</para>
	  </listitem>
      </varlistentry>
	  
	  <varlistentry>
      <term>XY</term>
        <listitem>
          <para>
	  Matrix with <emphasis>n</emphasis> lines and 2 columns containing the coordinates of the points to be projected on the grid.</para>
	  </listitem>
      </varlistentry>

	  <varlistentry>
      <term>C</term>
        <listitem>
          <para>
	  Output, vector of length <literal>size(XY,'r')</literal> : corresponding record numbers in the grid defined by the header.</para>
	  </listitem>
      </varlistentry>
	  
</variablelist>
  </refsection>



  <refsection>
    <title>Description</title>

    <para>Returns the record numbers of cells in a georeferenced grid, according to their XY coordinates.</para>
	<para>The point with coordinates <literal>(x_i,y_i)</literal> is associated with pixel <literal>(row_i,col_i)</literal> in the grid, i.e. record <literal>rec_i = row_i * ncols + col_i</literal></para>

  </refsection>

  <refsection>
    <title>Examples</title>
  </refsection>

   <refsection><title>See Also</title><simplelist type='inline'>
    
      <member> 
         <link linkend='rec2XY'>rec2XY</link>
      </member>
     
   </simplelist></refsection>


  <refsection>
    <title>Authors</title>

    <simplelist type="vert">
      <member>Nicolas LE MOINE</member>
    </simplelist>
  </refsection>
</refentry>
