piektdiena, 2010. gada 11. jūnijs

Converting DGN data to OSM (With RIGIS.lv given data)

DGN is Microstation format of GIS data.
First I got version 8 DGN file. This not worked with any of converters I have tryed.
With my request I got version 7 of same file. This file showed bit more success with ogr2ogr utility.
--
desktop:~/workspace/rigis$ ogr2ogr -f "GPX" RIGIS_dati.gpx RIGIS_dati_v7.dgn
ERROR 6: Cannot create GPX layer elements with unknown geometry type
ERROR 1: Terminating translation prematurely after failed
translation of layer elements (use -skipfailures to skip errors)
--
desktop:~/workspace/rigis$ ogr2ogr -f "ESRI Shapefile" RIGIS_dati.shp RIGIS_dati_v7.dgn
ERROR 1: RIGIS_dati.shp is not a directory.

ESRI Shapefile driver failed to create RIGIS_dati.shp
--
desktop:~/workspace/rigis$ ogr2ogr -f "KML" RIGIS_dati.kml RIGIS_dati_v7.dgn
ERROR 1: Latitude 312694.460000 is invalid. Valid range is [-90,90]. This warning will not be issued any more
Warning 1: Longitude 512080.260000 has been modified to fit into range [-180,180]. This warning will not be issued any more
--

Then I converted with no errors to CSV:

ogr2ogr -f "csv" RIGIS_dati.csv RIGIS_dati_v7.dgn

To my big surprise I got street names in it... but only with some internal reference number.

--
Type Level GraphicGroup ColorIndex Weight Style EntityNum MSLink Text
4 36 0 24 1 5 175 2929772



17 38 0 0 0 0 172 3416950 Stirnu iela
17 37 0 3 0 0 172 4463198 39A
--

Converting to GeoJSON also worked without errors:
--
desktop:~/workspace/rigis$ ogr2ogr -f "GeoJSON" RIGIS_dati.json RIGIS_dati_v7.dgn
--

That give me file with also with streets and numbers, but strangly in place of coordinates there is numbers like:

"coordinates": [ [ 511969.720000, 313385.750000 ], [ 512000.000000, 313353.990000 ], [ 512040.240000, 313311.020000 ] ]
"coordinates": [ [ 511913.850000, 313590.360000 ], [ 511929.933000, 313575.374000 ], [ 511978.606000, 313530.800000 ],
"coordinates": [ [ 512080.260000, 312694.460000 ], [ 512068.730000, 312652.400000 ], [ 512066.300000, 312639.210000 ] ]
--

Sooo.. thx to P.B. I got that thease coordinates is okey.. just need to transform from LKS92 / Latvia TM to WGS 84 (probably). Let's do it.

--
desktop:~/workspace/rigis$ ogr2ogr -f "GeoJSON" -s_srs EPSG:3059 -t_srs EPSG:4326 RIGIS_dati.json RIGIS_dati_v7.dgn
ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of
OGRCoordinateTransformation failed.
Failed to create coordinate transformation between the
following coordinate systems. This may be because they
are not transformable, or because projection services
(PROJ.4 DLL/.so) could not be loaded.
Source:
PROJCS["LKS92 / Latvia TM",
--
Sound like my ubuntu cannot find library file... let's help:
--
desktop:~$ cd /usr/lib
desktop:/usr/lib$ sudo ln -s libproj.so.0.6.6 libproj.so
--

This helped...

--
ogr2ogr -f "kml" -s_srs EPSG:3059 -t_srs EPSG:4326 RIGIS_dati.kml RIGIS_dati_v7.dgn
--
but surprise surprise .... all points goes to..... Lithuania ... and all points are in one place.

Nav komentāru:

Ierakstīt komentāru