Class Addresses
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.Test
-
- org.openstreetmap.josm.data.validation.tests.Addresses
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
public class Addresses extends Test
Performs validation tests on addresses (addr:housenumber) and associatedStreet relations.- Since:
- 5644
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
ADDR_CITY
protected static String
ADDR_FLATS
protected static String
ADDR_HOUSE_NAME
protected static String
ADDR_HOUSE_NUMBER
protected static String
ADDR_INTERPOLATION
protected static String
ADDR_NEIGHBOURHOOD
protected static String
ADDR_PLACE
protected static String
ADDR_POSTCODE
protected static String
ADDR_STREET
protected static String
ADDR_SUBURB
protected static String
ADDR_UNIT
protected static String
ASSOCIATED_STREET
protected static int
DUPLICATE_HOUSE_NUMBER
protected static int
HOUSE_NUMBER_TOO_FAR
protected static int
HOUSE_NUMBER_WITHOUT_STREET
private Set<String>
ignoredAddresses
private Map<String,Collection<OsmPrimitive>>
knownAddresses
protected static DoubleProperty
MAX_DUPLICATE_DISTANCE
protected static DoubleProperty
MAX_STREET_DISTANCE
protected static int
MULTIPLE_STREET_NAMES
protected static int
MULTIPLE_STREET_RELATIONS
protected static int
OBSOLETE_RELATION
-
Fields inherited from class org.openstreetmap.josm.data.validation.Test
checkBeforeUpload, checkEnabled, description, enabled, errors, IN_DOWNLOADED_AREA, IN_DOWNLOADED_AREA_STRICT, isBeforeUpload, name, partialSelection, progressMonitor, stopwatch, testBeforeUpload
-
-
Constructor Summary
Constructors Constructor Description Addresses()
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkDistance(OsmPrimitive house, Collection<Way> street)
protected List<TestError>
checkForDuplicate(OsmPrimitive p)
protected TestError
checkHouseNumbersWithoutStreet(OsmPrimitive p)
Checks for house numbers for which the street is unknown.private void
checkIfObsolete(Relation r)
Check if an associatedStreet Relation is obsolete.private void
collectAddress(OsmPrimitive p)
adds the OsmPrimitive to the address map if it complies to the restrictionsvoid
endTest()
Notification of the end of the test.(package private) static List<String>
expandHouseNumber(String houseNumber)
Split addr:housenumber on , and ; (common separators)Command
fixError(TestError testError)
remove obsolete relation.protected List<Relation>
getAndCheckAssociatedStreets(OsmPrimitive p)
(package private) static double
getDistance(OsmPrimitive a, OsmPrimitive b)
returns rough distance between two OsmPrimitives(package private) static List<String>
getSimplifiedAddresses(OsmPrimitive p)
(package private) static boolean
hasAddress(OsmPrimitive p)
protected void
initAddressMap(OsmPrimitive primitive)
boolean
isFixable(TestError testError)
Returns true if the given error can be fixed automaticallyprivate static boolean
isInWarnCountry(RelationMember m, String[] countryCodes)
(package private) static boolean
isPOI(OsmPrimitive p)
void
visit(Node n)
Visiting call for points.void
visit(Relation r)
Visiting call for relations.void
visit(Way w)
Visiting call for lines.-
Methods inherited from class org.openstreetmap.josm.data.validation.Test
addGui, clear, deletePrimitivesIfNeeded, getErrors, getName, getSource, initialize, isBuilding, isCanceled, isPrimitiveUsable, isResidentialArea, ok, setBeforeUpload, setPartialSelection, setShowElements, startTest, testBeforeUpload, visit
-
-
-
-
Field Detail
-
HOUSE_NUMBER_WITHOUT_STREET
protected static final int HOUSE_NUMBER_WITHOUT_STREET
- See Also:
- Constant Field Values
-
DUPLICATE_HOUSE_NUMBER
protected static final int DUPLICATE_HOUSE_NUMBER
- See Also:
- Constant Field Values
-
MULTIPLE_STREET_NAMES
protected static final int MULTIPLE_STREET_NAMES
- See Also:
- Constant Field Values
-
MULTIPLE_STREET_RELATIONS
protected static final int MULTIPLE_STREET_RELATIONS
- See Also:
- Constant Field Values
-
HOUSE_NUMBER_TOO_FAR
protected static final int HOUSE_NUMBER_TOO_FAR
- See Also:
- Constant Field Values
-
OBSOLETE_RELATION
protected static final int OBSOLETE_RELATION
- See Also:
- Constant Field Values
-
MAX_DUPLICATE_DISTANCE
protected static final DoubleProperty MAX_DUPLICATE_DISTANCE
-
MAX_STREET_DISTANCE
protected static final DoubleProperty MAX_STREET_DISTANCE
-
ADDR_HOUSE_NUMBER
protected static final String ADDR_HOUSE_NUMBER
- See Also:
- Constant Field Values
-
ADDR_INTERPOLATION
protected static final String ADDR_INTERPOLATION
- See Also:
- Constant Field Values
-
ADDR_NEIGHBOURHOOD
protected static final String ADDR_NEIGHBOURHOOD
- See Also:
- Constant Field Values
-
ADDR_PLACE
protected static final String ADDR_PLACE
- See Also:
- Constant Field Values
-
ADDR_STREET
protected static final String ADDR_STREET
- See Also:
- Constant Field Values
-
ADDR_SUBURB
protected static final String ADDR_SUBURB
- See Also:
- Constant Field Values
-
ADDR_CITY
protected static final String ADDR_CITY
- See Also:
- Constant Field Values
-
ADDR_UNIT
protected static final String ADDR_UNIT
- See Also:
- Constant Field Values
-
ADDR_FLATS
protected static final String ADDR_FLATS
- See Also:
- Constant Field Values
-
ADDR_HOUSE_NAME
protected static final String ADDR_HOUSE_NAME
- See Also:
- Constant Field Values
-
ADDR_POSTCODE
protected static final String ADDR_POSTCODE
- See Also:
- Constant Field Values
-
ASSOCIATED_STREET
protected static final String ASSOCIATED_STREET
- See Also:
- Constant Field Values
-
knownAddresses
private Map<String,Collection<OsmPrimitive>> knownAddresses
-
ignoredAddresses
private Set<String> ignoredAddresses
-
-
Constructor Detail
-
Addresses
public Addresses()
Constructor
-
-
Method Detail
-
getAndCheckAssociatedStreets
protected List<Relation> getAndCheckAssociatedStreets(OsmPrimitive p)
-
checkHouseNumbersWithoutStreet
protected TestError checkHouseNumbersWithoutStreet(OsmPrimitive p)
Checks for house numbers for which the street is unknown.- Parameters:
p
- primitive to test- Returns:
- error found, or null
-
isPOI
static boolean isPOI(OsmPrimitive p)
-
hasAddress
static boolean hasAddress(OsmPrimitive p)
-
collectAddress
private void collectAddress(OsmPrimitive p)
adds the OsmPrimitive to the address map if it complies to the restrictions- Parameters:
p
- OsmPrimitive that has an address
-
initAddressMap
protected void initAddressMap(OsmPrimitive primitive)
-
endTest
public void endTest()
Description copied from class:Test
Notification of the end of the test. The tester may perform additional actions and destroy the used structures.If you override this method, don't forget to cleanup
progressMonitor
(most overrides callsuper.endTest()
to do this).
-
checkForDuplicate
protected List<TestError> checkForDuplicate(OsmPrimitive p)
-
getSimplifiedAddresses
static List<String> getSimplifiedAddresses(OsmPrimitive p)
-
expandHouseNumber
static List<String> expandHouseNumber(String houseNumber)
Split addr:housenumber on , and ; (common separators)- Parameters:
houseNumber
- The housenumber to be split- Returns:
- A list of addr:housenumber equivalents
-
visit
public void visit(Node n)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for points.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Overrides:
visit
in classTest
- Parameters:
n
- The node to inspect.
-
visit
public void visit(Way w)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for lines.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Overrides:
visit
in classTest
- Parameters:
w
- The way to inspect.
-
visit
public void visit(Relation r)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for relations.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Overrides:
visit
in classTest
- Parameters:
r
- The relation to inspect.
-
getDistance
static double getDistance(OsmPrimitive a, OsmPrimitive b)
returns rough distance between two OsmPrimitives- Parameters:
a
- primitive ab
- primitive b- Returns:
- distance of center of bounding boxes in meters
-
checkDistance
protected void checkDistance(OsmPrimitive house, Collection<Way> street)
-
checkIfObsolete
private void checkIfObsolete(Relation r)
Check if an associatedStreet Relation is obsolete. This test marks only those relations which are complete and don't contain any information which isn't also tagged on the members. The strategy is to avoid any false positive.- Parameters:
r
- the relation
-
isInWarnCountry
private static boolean isInWarnCountry(RelationMember m, String[] countryCodes)
-
-