On Wed 2012-07-11 21:22:16, Michal Pustějovský wrote:
> Miroslav Šulc <fordfrog@...> writes:
> 
> > 
> > zdravím,
> > 
> > jsem tu nový a tak se chci zeptat, kde a s čím případně můžu pomoct, na
> > čem má smysl pracovat a na čem ne. co jsem třeba tak nějak pochopil, tak
> > adresní body asi aktuálně nemá smysl ručně v mapách řešit. přijde mi, že
> > aktuálně asi hlavním uživatelsky kvalitativním nedostatkem čr map jsou
> > ulice bez názvů, ale nemám přehled, v jakém rozsahu chybí názvy ulic a
> > jestli se na tom nějak pracuje. další problém, na který jsem narazil, je
> > že některé ulice na mapě vůbec nejsou. to se ale asi špatně hledá, pokud
> > člověk danou oblast nezná nebo ji nezpracovává globálně. chybějící ulice
> > by se asi daly najít porovnáním osm dat s nějakou db ulic. další věc,
> > která mě napadá, je "malování" budov, ale to si myslím, že je v tuhle
> > chvíli spíš bonus a v současnosti to nemá takovou prioritu.
> 
> Na doplňování názvů ulic ve městech může skvěle posloužit OSM Inspector
> (http://tools.geofabrik.de/osmi/?view=wtfe ; vrstva highways zobrazuje silnice
> bez ref. čísla nebo názvu - ale i u vesnic). Dalším dobrým nástrojem pro
> mapování je KeepRight (http://www.keepright.at/).

A nebo tahle vec :-). Vetsinou se trefi... Patri to do

~/sf/openstreetmap/svn.openstreetmap.org/applications/lib/libosm/nameit

                                                                        Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#include "Parser.h"
#include "Client.h"
#include "Node.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include "functions.h"

using std::cerr;
using std::cerr;
using std::endl;

void dotest(OSM::Components *comp1);

int main(int argc,char* argv[])
{
	if(argc<1)
	{
		cerr<<"Usage: test InOsmFile OsmUsername OsmPassword" << endl;
		exit(1);
	}
	
	std::ifstream in(argv[1]);
	OSM::Components *comp1 = OSM::Parser::parse(in);
	in.close();

	cerr << "Testing components from local file:" << endl;
	dotest(comp1);

	comp1->toXML(std::cout);

	delete comp1;

	return 0;

}

struct ltstr
{
  bool operator()(const std::string s1, const std::string s2) const
  {
    return s1 < s2;
  }
};


void
oneaddress(OSM::Way *w, OSM::Node *n1, OSM::Node *n2, OSM::Node *n,  std::map <std::string, float> &results)
{
	std::vector<std::string> keys = n->getTags();
	const std::string street = n->tags["addr:street"];

	if (street == "")
		return;

	float dist = OSM::distp(n->getLat(), n->getLon(), 
				n1->getLat(), n1->getLon(), 
				n2->getLat(), n2->getLon());

	if (dist < 0.0005) {
	  // cerr << "Have street " << street << " near way is " << w->tags["name"] << endl;
	  	results[street] += 1/(dist+.00001);
	}

}

static int total_ways, processed_ways, 
  	   test_total, test_okay, test_coverage, devel_total, devel_coverage;

void dotest(OSM::Components *comp1)
{
	comp1->rewindSegments();
	comp1->rewindWays();

	while(comp1->hasMoreWays())
	{
		OSM::Way *w = comp1->nextWay();
		//		cerr << "Way id: " << w->id << " tags:" << endl;

		std::vector<std::string> keys = w->getTags();
		OSM::Node *n1 = NULL, *n2 = NULL;
		std::map <std::string, float> results;

		total_ways++;

		if (w->tags["highway"] != "residential")
		  continue;
		
		processed_ways++;
#if 0
		for(int count=0; count<keys.size(); count++)
		{
		  	cerr  << "Key: " << keys[count] << " Value: " << 
				w->tags[keys[count]] << endl;
		}
#endif
		for(int count=0; count<w->nSegments(); count++)
		{
		  //			cerr  << "Node: " << w->getSegment(count) << endl;

			n2 = n1;
			n1 = comp1->getNode(w->getSegment(count));

			if (n2)
			{
				comp1->rewindNodes();
				while(comp1->hasMoreNodes())
				{
					OSM::Node *n = comp1->nextNode();
					oneaddress(w, n1, n2, n, results);
				}
			}

		}

		float max = 0; std::string maxs = "";

		cerr << w->id << " " << w->tags["name"];
		//		cerr << endl << "-------------------" << endl;
		for(std::map<std::string,float>::iterator i=results.begin(); 
		    i!=results.end(); i++) {
		  //		  	cerr << i->first << " - " << i->second << endl;
			if (i->second > max) {
				max = i->second;
				maxs = i->first;
			}
		}
		cerr << " : " << maxs << endl;
		if (w->tags["name"] != "") {
		  test_total++;
		  if (maxs != "") {
		    test_coverage++;
		    if (maxs == w->tags["name"])
		      test_okay++;
		    else {
		      w->tags["autoname"] = maxs;
		      w->tags["autoname:source"] = "nameit/uir-adr";
		    }
		  }
		} else {
		  devel_total++;
		  if (maxs != "") {
		    devel_coverage++;
		    w->tags["name"] = maxs;
		    w->tags["name:source"] = "nameit/uir-adr";
		    w->changed = 1;
		  }
		}
	}
	fprintf(stderr, "-------------------------------------------------------\n");
	fprintf(stderr, "%d total ways, %d processed\n", total_ways, processed_ways);
	fprintf(stderr, "... test total %d ways, coverage %d, okay %d (precission %d%%, recall %d%%)\n", test_total, test_coverage, test_okay, (int) ((test_okay*100.0) / test_coverage),  (int) ((test_coverage*100.0) / test_total));
	fprintf(stderr, "... devel total %d ways, coverage %d, okay ??? (precission ???, recall %d%%)\n", devel_total, devel_coverage, (int) ((devel_coverage*100.0) / devel_total));
}
_______________________________________________
Talk-cz mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/talk-cz

Odpovedet emailem