# Algorithm for lines comparison

I'm working on the import of land-use data into Openstreetmap. Unfortunately I've encountered a problem that has delayed my time table.

Take a look at the picture below: the red line is the main road (it is correctly mapped using GPS devices). The white area is the region that indicated the presence of the road: it should be placed exactly above the red line. Unfortunately, this region wasn't aquired with GPS data, but it was constructed mainly with aerial imaginery (so there are projection errors and also problems with the contrast and definition of the images): this explain the matching problem with the red line.

Since I possess a limited knowledge in this particular geometric problem, I was looking for any algorithms that could help me solve this. My thought was to handle the borders of the white region as two different lines and to apply some sort of matching algorithm. Ideally, the algorithm I'm looking for should be able to compare the features of two lines, and adjust one of them accordingly to the other.

Is there something similar that could help me? Or do you have any other possible solutions?

Thank you for your help and time.

• What comes to mind is that you need a 'least squares' method, but then in two dimensions. Maybe google for something like least squares 2 dimensions. I find stuff like On Least-Squares Fitting of Two-Dimensional Data with a Special Structure. Maybe add geography and mapping as additional keywords – Jan Doggen Jul 25 '16 at 14:58
• Wouldn't you rather ask this in gis.stackexchange.com ? – Tulains Córdova Aug 18 '16 at 14:17
• What exactly shall your algorithm do? Adjust the position of the background picture until it matches the red line as best as possible? Change/Distort that picture? Or change the red line until it fits into the white corridor (but I guess since you wrote "the red line is correct", that is not what you want). Or are you simply looking for a metrics how "good" the redline matches the picture? Consider to edit your question to add some clarifying words. – Doc Brown Nov 16 '16 at 15:02