<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Thanks to both Frank and Chaitanya this is now resolved. <br>
    Adding in the coordinate system to my GeoJSON solved the issue in 
    the latest versions of GDAL. <br>
    Leaving this out did not produce errors using ogrinfo, but it did
    not display the feature as WKT until the CRS was added in. <br>
    <br>
    {<br>
        "type": "Polygon",<br>
    <b>    "crs": {<br>
              "type": "EPSG",<br>
              "properties": {<br>
                  "code": 29902 <br>
              } <br>
          },</b><br>
        "coordinates": [<br>
            [<br>
                [<br>
                    123608.61199436858,<br>
                    206164.3985653462 <br>
                ],<br>
                [<br>
    <br>
    <br>
    On 21/11/2010 15:38, Chaitanya kumar CH wrote:
    <blockquote
      cite="mid:AANLkTimtcYOsfSxBx_6bHWNiHfvEkT3PjQ6jP0WsEZWr@mail.gmail.com"
      type="cite">Seth,<br>
      <br>
      You can obtain the WKT of the geometries in a vector data source
      by using ogrinfo with the -al option.<br>
      (<a moz-do-not-send="true" href="http://www.gdal.org/ogrinfo.html">http://www.gdal.org/ogrinfo.html</a>)<br>
      <br>
      <div class="gmail_quote">
        On Sun, Nov 21, 2010 at 6:20 PM, geographika <span dir="ltr">&lt;<a
            moz-do-not-send="true" href="mailto:geographika@gmail.com">geographika@gmail.com</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div>
            <div class="h5">On 19/11/2010 18:04, Frank Warmerdam wrote:<br>
              <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
                0.8ex; border-left: 1px solid rgb(204, 204, 204);
                padding-left: 1ex;">
                geographika wrote:<br>
                <blockquote class="gmail_quote" style="margin: 0pt 0pt
                  0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204);
                  padding-left: 1ex;">
                  Hi,<br>
                  <br>
                  I have upgraded from GDAL 1.6 (32bit Windows) to 1.7
                  (64 bit Windows) and the following command no longer
                  works:<br>
                  <br>
                  C:\mapserver\bin\gdal\apps\gdalwarp
                  C:\Data\Rasters\MiscSuit.tif C:\RasterClips\mytest.tif
                  -cutline c:\RasterClips\hello.json -te 118008.672141
                  177232.164284 138695.761666 206164.398565 -dstnodata
                  -9999<br>
                  <br>
                  I get the following message in the command prompt:<br>
                  <br>
                     Creating output file that is 414P x 579L.<br>
                     Processing input file C:\Data\Rasters\MiscSuit.tif.<br>
                     for band 1, destination nodata value has been
                  clamped to 0, the original value being out of range.<br>
                     ERROR 1: Failed to parse CUTLINE geometry wkt.<br>
                  <br>
                  The CUTLINE is valid GeoJSON (but would clearly be
                  invalid WKT) and produces the correct results in 1.6.<br>
                  The ogr formats lists GeoJSON as read/write.<br>
                  I am using 64-bit builds of GDAL taken from <a
                    moz-do-not-send="true"
                    href="http://vbkto.dyndns.org/sdk/" target="_blank">http://vbkto.dyndns.org/sdk/</a><br>
                  I have also tried using the development version of
                  GDAL 1.8dev but get the same message. If I do not use
                  a CUTLINE the gdalwarp completes successfully but the
                  new image does not contain any data from my original
                  image (all cells are NoData).<br>
                </blockquote>
                <br>
                Seth,<br>
                <br>
                Can you make the .json file available?  Does it work
                with OGR?  Try<br>
                ogrinfo on it.<br>
                <br>
                Hmm, tracking through the code the LoadCutline()
                function in gdalwarp.cpp<br>
                will read from the OGR datasource and convert the
                geometry to WKT which is<br>
                attached to the cutline property of the warp.  Later
                GDALWarpOperation::<br>
                Initialize() turns that into a polygon object and that
                is where the message<br>
                is coming from.  So I am *suspecting* improper WKT of
                some type is getting<br>
                produced somehow.  We will really need to see the WKT
                that is causing the<br>
                error to know more.<br>
                <br>
                If you are comfortable rebuilding things then try
                changing:<br>
                <br>
                   const char *pszCutlineWKT =<br>
                       CSLFetchNameValue(
                psOptions-&gt;papszWarpOptions, "CUTLINE" );<br>
                <br>
                   if( pszCutlineWKT )<br>
                   {<br>
                <br>
                in the file gdal/alg/gdalwarpoperation.cpp to something
                like:<br>
                <br>
                <br>
                   const char *pszCutlineWKT =<br>
                       CSLFetchNameValue(
                psOptions-&gt;papszWarpOptions, "CUTLINE" );<br>
                <br>
                   if( pszCutlineWKT )<br>
                   {<br>
                       printf( "WKT = %s\n", pszCutlineWKT );<br>
                <br>
                <br>
                Best regards,<br>
              </blockquote>
              <br>
            </div>
          </div>
          Thanks very much for your reply Frank.<br>
          I have uploaded the GeoJSON to <a moz-do-not-send="true"
            href="http://geographika.co.uk/downloads/test.json"
            target="_blank">http://geographika.co.uk/downloads/test.json</a><br>
          Running ogrinfo C:\test.json on the file produces the
          following results:<br>
          <br>
          ERROR 4: GeoJSON Driver doesn't support update.<br>
          Had to open data source read-only.<br>
          INFO: Open of `C:\RasterClips\hello.json'<br>
               using driver `GeoJSON' successful.<br>
          1: OGRGeoJSON (Polygon)<br>
          <br>
          Is it possible to use the ogr2ogr to convert GeoJSON to WKT to
          check if this is successful? WKT is not in the list of formats
          at <a moz-do-not-send="true"
            href="http://www.gdal.org/ogr/ogr_formats.html"
            target="_blank">http://www.gdal.org/ogr/ogr_formats.html</a><br>
          Compiling a 64bit  version of GDAL is on my list of things to
          learn, so I will try your second suggestion then.<br>
          <br>
          The gdalwarp with the same GeoJSON works in 1.6 but it does
          throw up the warning that:<br>
          <br>
          "the source raster dataset and the input vector layer do not
          have the same SRS.  Results will be probably incorrect."<br>
          <br>
          Regards,<br>
          <br>
          Seth
          <div>
            <div class="h5"><br>
              <br>
              <br>
              <br>
              _______________________________________________<br>
              gdal-dev mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
              <a moz-do-not-send="true"
                href="http://lists.osgeo.org/mailman/listinfo/gdal-dev"
                target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
      -- <br>
      Best regards,<br>
      Chaitanya kumar CH.<br>
      /tʃaɪθənjə/ /kʊmɑr/ <br>
      +91-9494447584<br>
      17.2416N 80.1426E<br>
    </blockquote>
    <br>
  </body>
</html>