Logotipo do OpenStreetMap OpenStreetMap

Newcastle nearing completion; Merkaator hacking

Publicado por c-j-b o 19 de Agosto de 2009 en English.

Go have a look-- the Newcastle is almost close to complete, with really only the Wickham and Carrington areas left to streetmap. It's obvious however that most of the areas that Bio, 'Mysterious German Carthography Student' and myself weren't responsible for will need a go-over survey to collect amenities, laneways, and such..

Merkaator users might be happy to hear that I solved the "Align Nodes" bug.. At the heart of it there was an 32-bit integer overflow issue. The Trac system seems to be down, and I've tried posting the findings and patches to the Merkaator mailing list, but in summary:

src/Maps/Coord.cpp:angle()
Problem code:
return sqrt((double)Lat*Lat+Lon*Lon));

Noob fix:
return sqrt((double)((long)Lat*(long)Lat+(long)Lon*(long)Lon));

I refactored and clarified some other code while I was working on it:

src/Maps/Coord.cpp:
double angle(Coord p1)
{
if (p1.length() == 0)
return 0;
double adjacent = (double)p1.lon() / p1.length();
if (p1.lat() > 0)
return acos(adjacent);
return -acos(adjacent);
}

src/Maps/FeatureManipulations.cpp:alignNodes():
void alignNodes(MapDocument* theDocument, CommandList* theList, PropertiesDock
* theDock)
{
[..]
double slope = angle(p2);
for (int i=2; iposition()-p1;
rotate(pos,-slope);
pos.setLat(0);
rotate(pos,slope);
pos=pos+p1;
theList->add(new MoveTrackPointCommand( Nodes[i], pos, theDocume
nt->getDirtyOrOriginLayer(Nodes[i]->layer()) ));
}
}

With now-working road alignment happening, the map of Newcastle is looking a lot prettier now. :-)

Localización: New Lambton, Newcastle, Newcastle-Maitland, City of Newcastle, New South Wales, 2305, Australia
Icona de correo electrónico Icona de Bluesky Icona de Facebook Icona de LinkedIn Icona de Mastodon Icona de Telegram Icona de X

Parola

Inicia sesión para deixar un comentario