A method for road surface detection, the method comprising: receiving, by a processor, ranging data including a plurality of ranging data points; extracting, by the processor, one or more ranging data points lying within a height range from the plurality of ranging data points; dividing, by the processor, the one or more extracted ranging data points into one or more grid cells (401, 603); setting, by the processor, a first horizontal position of a first cell point (403, 605) of a first grid cell (401, 603) of the one or more grid cells (401, 603) as being centered on the first grid cell (401, 603), the first cell point (403, 605) having a position defined within the grid cell (401, 603) and defining a ground surface for the grid cell (401, 603); determining, by the processor, a first most probable ground height of the one or more extracted ranging data points located in the first grid cell (401, 603) based on a probability density function of the one or more extracted ranging data points located in the first grid cell (401, 603); determining, by the processor, a value of a first median of a first range of the one or more extracted ranging data points centered around the first most probable ground height; setting, by the processor, a first vertical position of the first cell point (403, 605) as the value of the first median for the first grid cell (401, 603); and detecting, by the processor, the road surface based on the first vertical position and first horizontal position of the first cell point (403, 605), wherein a position of the road surface is determined based on the position of the cell point (403, 605) within the cell (401, 603). receiving, by a processor, ranging data including a plurality of ranging data points; extracting, by the processor, one or more ranging data points lying within a height range from the plurality of ranging data points; dividing, by the processor, the one or more extracted ranging data points into one or more grid cells (401, 603); setting, by the processor, a first horizontal position of a first cell point (403, 605) of a first grid cell (401, 603) of the one or more grid cells (401, 603) as being centered on the first grid cell (401, 603), the first cell point (403, 605) having a position defined within the grid cell (401, 603) and defining a ground surface for the grid cell (401, 603); determining, by the processor, a first most probable ground height of the one or more extracted ranging data points located in the first grid cell (401, 603) based on a probability density function of the one or more extracted ranging data points located in the first grid cell (401, 603); determining, by the processor, a value of a first median of a first range of the one or more extracted ranging data points centered around the first most probable ground height; setting, by the processor, a first vertical position of the first cell point (403, 605) as the value of the first median for the first grid cell (401, 603); and detecting, by the processor, the road surface based on the first vertical position and first horizontal position of the first cell point (403, 605), wherein a position of the road surface is determined based on the position of the cell point (403, 605) within the cell (401, 603).