https://issues.qgis.org/https://issues.qgis.org/favicon.ico2014-01-30T01:41:12ZQGIS Issue TrackingQGIS Application - Bug report #9414: Custom CRS with units=mm stored as units=mhttps://issues.qgis.org/issues/9414?journal_id=479012014-01-30T01:41:12ZLeyan Ouyang
<ul></ul><p>This is a limitation in OGR, not in QGis. When creating a custom CRS, QGis just uses the OGR function OSRImportFromProj4 to create the CRS. The stored string is the proj4 representation given by OGR, so this means the unit information was lost during the conversion back and forth with OGR.</p>
<p>I just tried with a simple C++ wrapper around OSRImportFromProj4, and it seems OGR doesn't keep the unit for at least dm,cm,mm. It will only work for some units: such as km, ft, yd, us-ft, us-yd, etc.</p>
<p>Another way to specify a unit is using the to_meter= parameter. This seems to be accepted by OSRImportFromProj4, could you try using :<br /><pre>+proj=tmerc +lat_0=51.4 +lon_0=7.0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +to_meter=0.001 +no_defs</pre>to see if it works with your data?</p>
<p>edit: seems it does not work either. I am actually working on improvements on the CRS management but this will have to wait for 2.4, I will see if I can include a simple bug correction for 2.2.</p> QGIS Application - Bug report #9414: Custom CRS with units=mm stored as units=mhttps://issues.qgis.org/issues/9414?journal_id=479182014-01-30T06:40:02ZAndre Joost
<ul></ul><p>Leyan Ouyang wrote:</p>
<blockquote>
<p>edit: seems it does not work either.</p>
</blockquote>
<p>No success on my side too.</p> QGIS Application - Bug report #9414: Custom CRS with units=mm stored as units=mhttps://issues.qgis.org/issues/9414?journal_id=479232014-01-30T12:29:24Zkyle -kyle@foo.bar
<ul></ul><p>All units reported by cs2cs -lu should be supported in parsing proj.4 strings in GDAL trunk. See gdal ticket:</p>
<p><a class="external" href="http://trac.osgeo.org/gdal/ticket/5370">http://trac.osgeo.org/gdal/ticket/5370</a></p>
<pre>
kyle@kyle-workstation:~/src/gdal/trunk/gdal$ cs2cs -lu
km 1000. Kilometer
m 1. Meter
dm 1/10 Decimeter
cm 1/100 Centimeter
mm 1/1000 Millimeter
kmi 1852.0 International Nautical Mile
in 0.0254 International Inch
ft 0.3048 International Foot
yd 0.9144 International Yard
mi 1609.344 International Statute Mile
fath 1.8288 International Fathom
ch 20.1168 International Chain
link 0.201168 International Link
us-in 1./39.37 U.S. Surveyor's Inch
us-ft 0.304800609601219 U.S. Surveyor's Foot
us-yd 0.914401828803658 U.S. Surveyor's Yard
us-ch 20.11684023368047 U.S. Surveyor's Chain
us-mi 1609.347218694437 U.S. Surveyor's Statute Mile
ind-yd 0.91439523 Indian Yard
ind-ft 0.30479841 Indian Foot
ind-ch 20.11669506 Indian Chain
</pre> QGIS Application - Bug report #9414: Custom CRS with units=mm stored as units=mhttps://issues.qgis.org/issues/9414?journal_id=480482014-01-31T02:36:18ZLeyan Ouyang
<ul></ul><p>I made a small pull request allowing to avoid the OGR conversion before storing the CRS. Based on my quick tests, it seems to solve your issue, could you try it? <a class="external" href="https://github.com/qgis/QGIS/pull/1130">https://github.com/qgis/QGIS/pull/1130</a></p>
<p>I am currently working on more significant improvements in the custom CRS management, but this will have to wait until 2.4.</p> QGIS Application - Bug report #9414: Custom CRS with units=mm stored as units=mhttps://issues.qgis.org/issues/9414?journal_id=480722014-01-31T06:37:59ZAndre Joost
<ul></ul><p>Leyan Ouyang wrote:</p>
<blockquote>
<p>I made a small pull request allowing to avoid the OGR conversion before storing the CRS. Based on my quick tests, it seems to solve your issue, could you try it?</p>
</blockquote>
<p>Sorry, I can't build QGIS on my own. But I added some test cases to the GDAL ticket <a class="external" href="http://trac.osgeo.org/gdal/ticket/5370">http://trac.osgeo.org/gdal/ticket/5370</a>. Only 2 of the 4 shapefiles correctly created by the latest GDAL-dev are displayed properly in QGIS 2.0.1</p> QGIS Application - Bug report #9414: Custom CRS with units=mm stored as units=mhttps://issues.qgis.org/issues/9414?journal_id=487702014-02-17T16:16:52ZLeyan Ouyang
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>I just tried the test cases in the GDAL tickets, they are correctly represented with QGis Master.</p>