開放街圖標誌 OpenStreetMap 開放街圖

Newcastle nearing completion; Merkaator hacking

於 2009年八月19日 由 c-j-bEnglish發表。

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. :-)

位置: New Lambton, Newcastle, Newcastle-Maitland, City of Newcastle, New South Wales, 2305, Australia
電子郵件圖示 藍天圖示 Facebook 圖示 LinkedIn 圖示 乳齒象圖示 Telegram 圖示 X 圖示

討論

登入 來留下評論