UK Postcode Java API serving up Open Data from Post Code
- Lookup a Post Code
- Bulk lookup Post Codes
- Get nearest Post Codes for a given longitude & latitude
- Bulk Reverse Geocoding
- Get a random Post Code
- Validate a Post Code
- Nearest Post Codes for Post Code
- Autocomplete a postcode partial
- Lookup Outward Code
- Nearest outward code for outward code
- Get nearest outward codes for a given longitude & latitude
PostcodeLookup.postcode("BS347NP").asJson();
PostcodeLookup.postcodes(new String[] { "OX49 5NU", "M32 0JG", "NE30 1DP" }).asJson()
PostcodeLookup.reverseGeocoding(0.629834723775309, 51.7923246977375).limit(100).radius(2000)
.wideSearch(true).asJson()
List<Reverse> reverseList = new ArrayList<>();
ReverseGeocoding reverseGeocoding = new ReverseGeocoding();
//Create first Reverse
Reverse reverse = reverseGeocoding.new Reverse();
reverse.setLongitude(0.629834723775309);
reverse.setLatitude(51.7923246977375);
reverse.setLimit(0);
reverse.setRadius(0);
reverse.setWideSearch(false);
//Add Reverse to reverseList
reverseList.add(reverse);
//Create second Reverse
reverse = reverseGeocoding.new Reverse(-2.49690382054704, 53.5351312861402, 5, 1000, false);
//Add Reverse to reverseList
reverseList.add(reverse);
PostcodeLookup.reverseGeocodings(reverseList).asJson();
PostcodeLookup.randomPostcode().asJson();
PostcodeLookup.isValid("ST42EU");
PostcodeLookup.nearestPostcode("ST4 2EU").asJson();
Limits number of postcodes matches to return based on limit. Defaults to 10. Needs to be less than 100.
PostcodeLookup.nearestPostcode("ST4 2EU").limit(20).asJson();
Limits number of postcodes matches to return based on radius. Defaults to 100m. Needs to be less than 2,000m.
PostcodeLookup.nearestPostcode("ST42EU").radius(100).asJson();
PostcodeLookup.autocomplete("ST4").asJson();
Limits number of postcodes matches to return based on limit. Defaults to 10. Needs to be less than 100.
PostcodeLookup.autocomplete("ST4").limit(20).asJson();
PostcodeLookup.lookupOutwardCode("ST4").asJson();
PostcodeLookup.nearestOutwardCode("ST4").asJson();
Limits number of postcodes matches to return based on limit. Defaults to 10. Needs to be less than 100.
PostcodeLookup.nearestOutwardCode("ST4").limit(5).asJson();
Limits number of postcodes matches to return based on radius. Defaults to 5,000m. Needs to be less than 25,000m.
PostcodeLookup.nearestOutwardCode("ST4").radius(20000).asJson();
PostcodeLookup.outcodeReverseGeocoding(0.637189329739338, 51.8051006359272).asJson();
Limits number of postcodes matches to return based on limit. Defaults to 10. Needs to be less than 100.
PostcodeLookup.outcodeReverseGeocoding(0.637189329739338, 51.8051006359272).limit(20).asJson();
Limits number of postcodes matches to return based on radius. Defaults to 5,000m. Needs to be less than 25,000m.
PostcodeLookup.outcodeReverseGeocoding(0.637189329739338, 51.8051006359272).radius(10000).asJson();