<div dir="ltr">Ah, that fixed it! Thanks :-)<div><br></div><div>- Thomas</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 27, 2014 at 1:57 PM, Dmitriy Baryshnikov <span dir="ltr"><<a href="mailto:bishop.dev@gmail.com" target="_blank">bishop.dev@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Hi,<br>
      <br>
      This is usually according to the locale. Try set "C" locale like
      this.<br>
      <pre><code><span>cha* </span></code><code><span><span>old_locale = </span>setlocale</span><span>(</span><span>LC_NUMERIC</span><span>,</span><span> </span><span>"C"</span><span>);

before opening datasource

and reset it back after reading all fetures

</span></code><span><code><span>setlocale</span><span>(</span><span>LC_NUMERIC</span><span>,</span><span> </span></code>old_locale</span>);
</pre>
      <br>
      This is not the solution (I fixed it here
      <a href="http://trac.osgeo.org/gdal/ticket/5461" target="_blank">http://trac.osgeo.org/gdal/ticket/5461</a>) but some kind of
      workaround.<br>
      <br>
      <pre cols="72">Best regards,
    Dmitry</pre>
      <a href="tel:27.07.2014%2015" value="+12707201415" target="_blank">27.07.2014 15</a>:40, Thomas Sevaldrud пишет:<br>
    </div>
    <blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div><font face="arial, sans-serif">(Sorry about the repost, I
            forgot the subject tag in the previous one..)</font></div>
        <span style="font-family:arial,sans-serif;font-size:13px">
          <div><span style="font-family:arial,sans-serif;font-size:13px"><br>
            </span></div>
          Hi, I'm having a strange problem that appears to be related to
          the GeoJSON driver in GDAL 1.11.0</span>
        <div style="font-family:arial,sans-serif;font-size:13px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">
          When reading a polygon geometry in geographical lat/lon
          coordinates, all my coordinate values are returned in integer
          degrees. When using ogrinfo it dumps the coordinate values
          with correct decimals, so it must be something I have done
          wrong... Here is the relevant code:</div>
        <div style="font-family:arial,sans-serif;font-size:13px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">
          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">   </span><span style="color:rgb(128,0,128)">OGRDataSource</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(0,0,0)">ds</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">OGRSFDriverRegistrar</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">Open</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">filename_</span><span style="color:rgb(0,0,0)">.</span><span style="color:rgb(0,0,0)">c_str</span><span style="color:rgb(0,0,0)">(),</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">FALSE</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">);</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"></pre>
          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">   </span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">num_layers</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">ds</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">GetLayerCount</span><span style="color:rgb(0,0,0)">();</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">   </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">num_layers</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(0,0,0)">++)</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">   </span><span style="color:rgb(0,0,0)">{</span></pre>
          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">      </span><span style="color:rgb(128,0,128)">OGRLayer</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">layer</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">ds</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">GetLayer</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(0,0,0)">);</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">      </span><span style="color:rgb(0,0,0)">layer</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">ResetReading</span><span style="color:rgb(0,0,0)">();</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"></pre>
          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">      </span><span style="color:rgb(128,0,128)">OGRFeature</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">feature</span><span style="color:rgb(0,0,0)">;</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">      </span><span style="color:rgb(128,128,0)">while</span><span style="color:rgb(0,0,0)">((</span><span style="color:rgb(0,0,0)">feature</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">layer</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">GetNextFeature</span><span style="color:rgb(0,0,0)">())</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">!=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">NULL</span><span style="color:rgb(0,0,0)">)</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">      </span><span style="color:rgb(0,0,0)">{</span></pre>
          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">         </span><span style="color:rgb(128,0,128)">OGRGeometry</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">geometry</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">feature</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">GetGeometryRef</span><span style="color:rgb(0,0,0)">();</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">         </span><span style="color:rgb(128,128,0)">if</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">geometry</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">==</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">NULL</span><span style="color:rgb(0,0,0)">)</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,128,0)">continue</span><span style="color:rgb(0,0,0)">;</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"></pre>
          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">         </span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">geom_type</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">wkbFlatten</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">geometry</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">getGeometryType</span><span style="color:rgb(0,0,0)">());</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"></pre>
          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">         </span><span style="color:rgb(128,128,0)">if</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">geom_type</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">==</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">wkbPolygon</span><span style="color:rgb(0,0,0)">)</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">         </span><span style="color:rgb(0,0,0)">{</span></pre>
          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,128)">OGRPolygon</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">ogr_poly</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">OGRPolygon</span><span style="color:rgb(0,0,0)">*)</span><span style="color:rgb(0,0,0)">geometry</span><span style="color:rgb(0,0,0)">;</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,128)">OGRLinearRing</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">ext_ring</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">ogr_poly</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">getExteriorRing</span><span style="color:rgb(0,0,0)">();</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"></pre>
          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">ext_ring</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">getNumPoints</span><span style="color:rgb(0,0,0)">()</span><span style="color:rgb(192,192,192)"> </span><u></u>-<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">1</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(0,0,0)">++)</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,0,0)">{</span><span style="color:rgb(192,192,192);font-family:arial">               </span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">               </span><span style="color:rgb(128,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">x</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">ext_ring</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">getX</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(0,0,0)">);</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">               </span><span style="color:rgb(128,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">y</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">ext_ring</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">getY</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">j</span><span style="color:rgb(0,0,0)">);</span></pre>

          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">               ...</span></pre>
          <pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"></pre>
          Now, the x, and y values here are always truncated to integer
          values. This does not happen with for example shp files.</div>
        <div style="font-family:arial,sans-serif;font-size:13px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:13px">Any
          ideas what I might have done wrong here?</div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br></div>