Not Exporting Global Coordinates While Converting to Lanelet2

Hi,

I am trying to convert an OSM data to Lanelet2 format. I used CommonRoad Python API and GUI seperately for this.
Firstly I tried to download and convert the data directly from the GUI but it cost too much amount of RAM of my computer after a several trys. After that, I switched into the Python API with an .osm file that I downloaded from JOSM.

When I convert my JOSM file to CommonRoad, all coordinates comes in a local cartesian coordinate system. After that when I convert that to Lanelet2 format, all the local coordinates corresponding to the related node are exported as Lanelet2 format. So, my Lanelet2 file is placed at the center of my projection in every export. Additionally, it makes this in every coordinate or projection type. In the below image, you can see the CommonRoad export at left and Lanelet2 export on right.

After that, when I manually translated those coordinates to my origin, a scale and a translation problem occurs. The below image shows the error visually. The red circle correspondes the blue circle in OpenStreetMap basemap.

After I hold and translate it to the correct position with the road junction at the left of the .osm file, we can see the scale error.

I think there is a projection error caused from the local coordinates. The more we get away from the projection center, the corruption of the map increases. My coordinates are 35.324064 and 139.349550 as latitudes and longitudes. So this corruption is normal to me.

How can I solve that? I tried several projections and tried different parameters. Nothing changes the local coordinates in the CommonRoad file. Is there a way to solve that?

Thank you for your attention.
Ata Parlar

Hi Ata,

there is a bug in the OSM conversion, i.e., in the way the projection is used.
We try to fix the bug a soon as possible.

I will check whether our API for the OSM conversion via SUMO is better in the next days.

Best,
Sebastian

1 Like

Hi Sebastian,

Thank you for your answer. I am working with direct OSM conversion. I found out that in osm_parser.py for converting geographical coordinates to local cartesian coordinates, a spherical conversion method is used. Due to the ellipsoidal models we use for latitude and longitude, I used the formulas under the Length of a Degree heading in this Wikipedia link: Geographic coordinate system - Wikipedia

After doing that, the size corruption on the map is repaired. Now, I can get a good map with UTM projection. Our test zone placed in UTM Zone 35, in Istanbul. It is a 30km road. Here is an image in JOSM:

This seems a little bit rotated but when I convert it to the local coordinates from an origin placed in the 35TPF MGRS grid origin, we can use it with our simulation environment in Unity - AWSIM. We are trying to use those lanelet2 maps with a simulation environment which is created from OpenStreetMap data. Here is 2 images from AWSIM:

So, I thought that the visualization problem in JOSM maybe caused by using latitude and longitudes intead of using easting and northing for UTM projection.

I know that CommonRoad discussions are moved to Github but the this issue is started here and I preferred to comment here. Now I am preparing a PR in Github for lat-lon conversion with ellipsoidal calculations. Should I firstly open an issue before sending the PR?

Best Regards
Ata Parlar

You can directly create a PR. Just mention the problems and changes there again (for the case a colleague will review it).

1 Like