ogr2osm icon indicating copy to clipboard operation
ogr2osm copied to clipboard

Coordinate accuracy

Open roelderickx opened this issue 4 years ago • 2 comments

After a system upgrade (python from version 3.9.2 to 3.9.4 and GDAL from version 3.0.4 to 3.2.2) the testcases fail. Here is an example of the first nodes before and after the upgrade:

-  <node visible="true" id="-2" lat="49.210517895" lon="-122.869117973"/>
+  <node visible="true" id="-2" lat="49.210518573" lon="-122.869133894"/>

-  <node visible="true" id="-3" lat="49.210522516" lon="-122.867400328"/>
+  <node visible="true" id="-3" lat="49.210523197" lon="-122.8674163"/>

-  <node visible="true" id="-5" lat="49.211948022" lon="-122.86739095"/>
+  <node visible="true" id="-5" lat="49.211948704" lon="-122.867406972"/>

-  <node visible="true" id="-6" lat="49.211944294" lon="-122.864626998"/>
+  <node visible="true" id="-6" lat="49.211944981" lon="-122.864643102"/>

-  <node visible="true" id="-8" lat="49.208017674" lon="-122.87588432"/>
+  <node visible="true" id="-8" lat="49.208018337" lon="-122.875899951"/>

A similar problem can be seen for the tags. However, contrary to the coordinates which are fetched as doubles the attributes are fetched as string.

-    <tag k="YTD_COST" v="1.54"/>
+    <tag k="YTD_COST" v="1.540000000000000"/>

-    <tag k="LC_COST" v="19.60"/>
+    <tag k="LC_COST" v="19.600000000000001"/>

This leaves a couple of open questions:

  • Which component is to blame?
  • In what version was it introduced and what issue was being tried to resolve?
  • Is the new version more or less accurate than the old version?
  • Is there are parameter which can be set to obtain the same result for all versions, preferably the most accurate?

roelderickx avatar May 12 '21 19:05 roelderickx

I have tried downgrading GDAL to version 3.0.4 to no effect. I set up docker using the Dockerfile from @HSLdevcom (thanks!) but the results are still not the same as before.

roelderickx avatar May 13 '21 15:05 roelderickx

An updated docker image is available in the master branch using the default ubuntu packages for GDAL. All test cases pass succesfully in this image, at least there is a reliable test environment now. The problem described in this issue is reproducible using the docker image from osgeo/gdal, using the latest version of GDAL.

FROM osgeo/gdal:ubuntu-full-3.2.2

WORKDIR /app

RUN apt-get update \
  && apt-get install -y \
    libprotobuf-dev \
    libxml2-utils \
    osmctools \
    protobuf-compiler \
    python3-pip

RUN pip3 install \
  --no-cache-dir \
  cram \
  lxml \
  protobuf

# A clumsy hack to avoid errors
RUN cd /usr/lib/python3/dist-packages/osgeo \
  && ln -s ./_gdal.cpython*.so ./_gdal.so \
  && ln -s ./_gdal_array.cpython*.so ./_gdal_array.so \
  && ln -s ./_gdalconst.cpython*.so ./_gdalconst.so \
  && ln -s ./_gnm.cpython*.so ./_gnm.so \
  && ln -s ./_ogr.cpython*.so ./_ogr.so \
  && ln -s ./_osr.cpython*.so ./_osr.so

ENV PYTHONPATH=/usr/lib/python3/dist-packages/

roelderickx avatar May 30 '21 16:05 roelderickx