Changeset 33735f1 in osmose-backend


Ignore:
Timestamp:
Oct 19, 2012 7:31:27 PM (6 years ago)
Author:
Jocelyn Jaubert <jocelyn.jaubert@…>
Branches:
master
Children:
396aa8f
Parents:
205a2fe (diff), 13079ea (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'frodrigo/master'

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Analyser_Merge.py

    r48a9867 r0c74840  
    166166sql30 = """ 
    167167SELECT 
    168     id, 
    169     type, 
    170     ST_AsText(geom), 
    171     official_tags, 
    172     official_fields, 
    173     osm_tags 
    174 FROM ( 
    175     SELECT 
    176         DISTINCT ON (ref, id) 
    177         missing_official.ref, 
    178         missing_official.tags AS official_tags, 
    179         missing_official.fields AS official_fields, 
    180         missing_osm.type, 
    181         missing_osm.id, 
    182         missing_osm.tags AS osm_tags, 
    183         missing_osm.geom 
    184     FROM 
    185         missing_official, 
    186         missing_osm 
    187     WHERE 
    188         ST_DWithin(missing_official.geom, missing_osm.geom, %(conflationDistance)s) 
    189     ORDER BY 
    190         ref, 
    191         id, 
    192         ST_Distance(missing_official.geom, missing_osm.geom) ASC 
    193 ) AS t 
    194 ; 
     168    DISTINCT ON (id) 
     169    missing_osm.id, 
     170    missing_osm.type, 
     171    ST_AsText(missing_osm.geom), 
     172    missing_official.tags AS official_tags, 
     173    missing_official.fields AS official_fields, 
     174    missing_osm.tags AS osm_tags 
     175FROM 
     176    missing_official, 
     177    missing_osm 
     178WHERE 
     179    ST_DWithin(missing_official.geom, missing_osm.geom, %(conflationDistance)s) 
     180ORDER BY 
     181    missing_osm.id, 
     182    ST_Distance(missing_official.geom, missing_osm.geom) ASC 
    195183""" 
    196184 
     
    350338                "data": [typeMapping[res[1]], None, self.positionAsText], 
    351339                "text": self.text(defaultdict(lambda:None,res[3]), defaultdict(lambda:None,res[4])), 
    352                 "fix": {"+": res[3], "~": {"source": res[3]['source']}} if res[5].has_key('source') else {"+": res[3]}, 
     340                "fix": self.mergeTags(res[5], res[3]), 
    353341            } ) 
    354342 
     
    372360        file.write("\"%s\",\"%s\",FIXME,%s,%s,%s\n" % (self.officialName, self.officialURL, official_non_merged, osm_non_merged, merged)) 
    373361        file.close() 
     362 
     363    def mergeTags(self, osm, official): 
     364        fix = {"+": {}, "~":{}} 
     365        for o in official: 
     366            if o in osm: 
     367                if osm[o] == official[o]: 
     368                    pass 
     369                else: 
     370                    if o == "source": 
     371                        fix["~"][o] = osm[o]+";"+official[o] 
     372                    else: 
     373                        fix["~"][o] = official[o] 
     374            else: 
     375                fix["+"][o] = official[o] 
     376        return fix 
    374377 
    375378    def dumpCSV(self, sql, ext, head, callback): 
  • analyser_osmosis_tag_typo.py

    r6291197 r13079ea  
    5353            'maxweight', 'maxheight', 
    5454            'stop', 'shop', 
     55            'stars', 'start', 
    5556            'services', 'service') 
    5657    ) AS keys 
  • analyser_osmosis_way_approximate.py

    rc8f11dd r223429e  
    9090            (tags?'railway' AND tags->'railway' = 'rail') OR 
    9191            (tags?'railway' AND tags->'waterway' = 'river') OR 
    92             (tags?'highway' AND tags->'highway' IN ('motorway', 'trunk', 'primary')) 
     92            (tags?'highway' AND tags->'highway' IN ('motorway', 'trunk', 'primary', 'secondary')) 
    9393        ) AND 
    9494        ST_NPoints(linestring) >= 4 
  • plugins/TagFix_DuplicateValue.py

    rdebdaed ra98e220  
    5959            if k == 'source': 
    6060                v = v.replace('Cadastre ; mise', 'Cadastre, mise') 
    61             if ';' in v: 
     61            if ';' in v and k not in ('destination:lanes'): 
    6262                vs = map(lambda w: w.strip(), v.split(';')) 
    6363                if len(vs) != len(set(vs)): 
  • analyser_osmosis_building_shapes.py

    r74cf95b r6748e43  
    3838    ST_Area(ST_MakePolygon(ST_Transform(linestring,2154)))/ST_Area(ST_MinimumBoundingCircle(ST_Transform(linestring,2154))) > 0.95 AND 
    3939    ST_MaxDistance(ST_Transform(linestring,2154), ST_Transform(linestring,2154)) > 5 AND 
    40     array_length(akeys(delete(delete(delete(delete(delete(tags, 'created_by'), 'source'), 'name'), 'building', 'note:qadastre'))), 1) IS NULL 
     40    array_length(akeys(delete(delete(delete(delete(delete(tags, 'created_by'), 'source'), 'name'), 'building'), 'note:qadastre')), 1) IS NULL 
    4141""" 
    4242 
     
    5353    is_polygon AND 
    5454    ST_MaxDistance(ST_Transform(linestring,2154), ST_Transform(linestring,2154)) > 300 AND 
    55     array_length(akeys(delete(delete(delete(delete(delete(tags, 'created_by'), 'source'), 'name'), 'building', 'note:qadastre'))), 1) IS NULL 
     55    array_length(akeys(delete(delete(delete(delete(delete(tags, 'created_by'), 'source'), 'name'), 'building'), 'note:qadastre')), 1) IS NULL 
    5656""" 
    5757 
  • analyser_osmosis_roundabout_level.py

    ra9cc721 r205a2fe  
    139139        junction.linestring && w1.linestring AND 
    140140        w1.tags?'highway' AND 
    141         w1.tags->'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'residential', 'unclasified', 'road') AND 
     141        w1.tags->'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'residential', 'unclassified', 'road') AND 
    142142        w1.id != junction.id 
    143143    JOIN ways AS w2 ON 
    144144        junction.linestring && w2.linestring AND 
    145145        w2.tags?'highway' AND 
    146         w2.tags->'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'residential', 'unclasified', 'road') AND 
     146        w2.tags->'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'residential', 'unclassified', 'road') AND 
    147147        w2.id != junction.id 
    148148WHERE 
    149     junction.tags->'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'residential', 'unclasified', 'road') AND 
     149    junction.tags->'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'residential', 'unclassified', 'road') AND 
    150150    array_length(junction.nodes, 1) > 3 AND 
    151151    junction.nodes[1] = junction.nodes[array_length(junction.nodes, 1)] AND 
Note: See TracChangeset for help on using the changeset viewer.