ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Get map dimensions for map saved from map server

asked 2017-12-06 15:43:13 -0500

fiorano10 gravatar image

After implementing SLAM using gmapping, the map was saved using map_server package, as a pgm file and a yaml file, I need to know the dimensions of the objects in the map and the map itself, how do I achieve this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-12-06 16:41:39 -0500

jayess gravatar image

Get the dimensions of the pgm (x pixels by y pixels) then examine your yaml file. In the yaml file the resolution of the map is given in meters/pixel. This will allow you to determine the size of your map in meters. You would figure out the size of objects in the map in a similar fashion (i.e., multiply the number of pixels your object takes by the resolution of your map and you'll have the physical size of the object).

Refer to

edit flag offensive delete link more


What are some ways I could get the x and y pixels for the map and not the pgm file? My pgm file has larger dimensions than the actual map.

fiorano10 gravatar image fiorano10  ( 2017-12-06 16:56:11 -0500 )edit

You can just manually edit the pgm so that it is the size of your map. I've used GIMP to edit maps before.

jayess gravatar image jayess  ( 2017-12-06 16:57:53 -0500 )edit

Question Tools

1 follower


Asked: 2017-12-06 15:43:13 -0500

Seen: 1,996 times

Last updated: Dec 06 '17