public class PostalAddress
extends java.lang.Object
implements java.lang.Cloneable
Node
or Way
), for use in future address lookups. This covers the tags
"addr:city",
"addr:country",
"addr:housename",
"addr:housenumber",
"addr:place",
"addr:postcode",
"addr:province",
"addr:state",
"addr:street".
"addr:town", and
"addr:village",Modifier and Type | Field and Description |
---|---|
java.lang.String |
city
Value of the "addr:city", "addr:town", or "addr:village" tag.
|
java.lang.String |
country
Value of the "addr:country" tag.
|
java.lang.String |
houseNumber
Value of the "addr:housenumber" or "addr:housename" tag.
|
long |
id
The OSM element ID for the Node or Way.
|
static int |
INV_NO_CITY
Error bitmask for a PostalAddress without a
city . |
static int |
INV_NO_HOUSENUMBER
Error bitmask for a PostalAddress without a
houseNumber . |
static int |
INV_NO_STREET
Error bitmask for a PostalAddress without a
street . |
static int |
INV_PERFECT_FAILURE
Combination of error bits that implies an unusable PostalAddress, where if any
one of these bits is missing (and no other error bits are set), then the partial
address can be stored (and potentially fixed by later OSM records or by post-import
correction utilities).
|
static int |
INV_TOO_LONG_CITY
Error bitmask for a PostalAddress with too long a
city . |
static int |
INV_TOO_LONG_COUNTRY
Error bitmask for a PostalAddress with too long a
country . |
static int |
INV_TOO_LONG_HOUSENUMBER
Error bitmask for a PostalAddress with too long a
houseNumber . |
static int |
INV_TOO_LONG_POSTCODE
Error bitmask for a PostalAddress with too long a
postCode . |
static int |
INV_TOO_LONG_STATEPROVINCE
Error bitmask for a PostalAddress with too long a
state or province . |
static int |
INV_TOO_LONG_STREET
Error bitmask for a PostalAddress with too long a
street . |
boolean |
isWay
|
int |
latitude
Latitude of address in millionths of degrees North.
|
int |
longitude
Longitude of address in millionths of degrees East.
|
static java.lang.String[] |
POSTAL_QUADRANTS
Array pf quadrant suffixes for postal address tables.
|
java.lang.String |
postCode
Value of the "addr:postcode" tag.
|
java.lang.String |
stateProvince
Value of the "addr:state" or "addr:province" tag.
|
java.lang.String |
street
Value of the "addr:street" or "addr:place" tag.
|
Constructor and Description |
---|
PostalAddress()
Create an empty PostalAddress.
|
PostalAddress(boolean isWay,
long id,
int latitude,
int longitude)
Create a PostalAddress record with the geographical (not postal) indexing information.
|
PostalAddress(java.sql.ResultSet rs)
Create a PostalAddress object from the currently pointed record in a ResultSet.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Reset the PostalAddress back to all fields empty so it can be loaded for the
next Node or Way with address dara in it.
|
java.lang.Object |
clone()
Creates and returns a copy of this object.
|
int |
getInvalidReasons()
Get the reasons why a PostalRecord is not acceptable.
|
int |
getQuadrantIndex()
Get the quadrant index for the geographical coordinates of this PostalAddress.
|
static int |
getQuadrantIndex(int latitude,
int longitude)
Determine which planetary quadrant (database table) an address should be stored in.
|
boolean |
isEmpty()
Test whether this PostalAddress has enough information to be worth saving.
|
void |
set(java.lang.String fieldName,
java.lang.String value)
Copy an OSM node or way tag that is part of a postal address.
|
public static final java.lang.String[] POSTAL_QUADRANTS
public static final int INV_NO_HOUSENUMBER
houseNumber
.getInvalidReasons()
,
Constant Field Valuespublic static final int INV_TOO_LONG_HOUSENUMBER
houseNumber
.getInvalidReasons()
,
Constant Field Valuespublic static final int INV_NO_STREET
street
.getInvalidReasons()
,
Constant Field Valuespublic static final int INV_TOO_LONG_STREET
street
.getInvalidReasons()
,
Constant Field Valuespublic static final int INV_NO_CITY
city
.getInvalidReasons()
,
Constant Field Valuespublic static final int INV_TOO_LONG_CITY
city
.getInvalidReasons()
,
Constant Field Valuespublic static final int INV_TOO_LONG_STATEPROVINCE
state or province
.getInvalidReasons()
,
Constant Field Valuespublic static final int INV_TOO_LONG_POSTCODE
postCode
.getInvalidReasons()
,
Constant Field Valuespublic static final int INV_TOO_LONG_COUNTRY
country
.getInvalidReasons()
,
Constant Field Valuespublic static final int INV_PERFECT_FAILURE
public long id
public int latitude
public int longitude
public boolean isWay
public java.lang.String houseNumber
public java.lang.String street
public java.lang.String city
public java.lang.String stateProvince
public java.lang.String postCode
public java.lang.String country
public PostalAddress()
public PostalAddress(boolean isWay, long id, int latitude, int longitude)
public PostalAddress(java.sql.ResultSet rs) throws java.sql.SQLException
rs
- ResultSet containing the DB record to extractjava.sql.SQLException
- if the fields couldn't be extracted from the ResultSet (wrong table queried?)public void clear()
public boolean isEmpty()
public int getInvalidReasons()
INV_NO_HOUSENUMBER
,
INV_TOO_LONG_HOUSENUMBER
,
INV_NO_STREET
,
INV_TOO_LONG_STREET
,
INV_NO_CITY
,
INV_TOO_LONG_CITY
,
INV_TOO_LONG_STATEPROVINCE
,
INV_TOO_LONG_POSTCODE
,
INV_TOO_LONG_COUNTRY
public void set(java.lang.String fieldName, java.lang.String value)
fieldName
- OSM tag namevalue
- String value associated with the tag to savepublic static int getQuadrantIndex(int latitude, int longitude)
latitude
- latitude in millionths of degrees Northlongitude
- longitude in millionths of degrees Eastpublic int getQuadrantIndex()
public java.lang.Object clone()
clone
in class java.lang.Object
Cloneable