How to get house number, street, postcode from a free-form address string
Computers & Technology → Technology
- Author Alfiya Tarasenko
- Published October 5, 2021
- Word count 832
If you have a service related to maps and addresses, parsing and standardizing become necessary for development. There are many difficulties in this process, so as ways of overcoming them. In this article, you’ll find the basics of standardization methods and a bit of detailed advice on choosing the right one.
What is Address Parsing?
When clients of your website enter their address, it will probably be presented as a stroke. To check if the address is correct and exists, this stroke must be divided into components. Also, all entered addresses must look the same. Different methods for proceeding with this operation are called parsing addresses from strings and standardizing them.
Why Is It Difficult?
The main problem is a human factor. People rarely enter their addresses the same way, and programs sometimes make it look like an unreadable combination with many classes.
Another difficulty is in many variants of addresses. Many countries have standards and many abbreviations meaning the same (does ‘St’ mean ‘Street’ or ‘Saint’?).
To help you solve this task, we collected and analyzed ways of how to process addresses. Here is a list of popular technologies below. They are listed from the most primitive to the most complicated and versatile ones.
1. RegEx Address Parser
Before you’ve read that, dealing with addresses with regular expressions is not effective. Still, it can be useful in some situations. For this method, you need a pattern with meta-symbols and symbols.
For example, a stroke looking like "NAME_FOR_CITY XX, NAME_FOR_STREET YY", and addresses in this format can be parsed like city: "NAME_FOR_CITY", postcode: "XX", street: "NAME_FOR_STREET", house number: "YY". Just select the regexp and find the preferable expression.
Compiling this method:
-
the most effective technology for strictly structured strings, when standardizing is not required;
-
no need to use external libraries or address parsing APIs;
-
completely ineffective with freeform addresses;
-
may cause performance, debugging, and maintenance problems.
2. NPM-packages
NPM is a cross-platform package manager included in the Node.js system. On its website, you can search for external libraries for address parsing. They vary strongly and fit certain country postcodes, local specifics, and address standards.
For example, if you are processing Australian addresses, you should search for an Australian parsing package. Some popular ones are:
-
US Street Address Parser, that understands suffixes and abbreviations, 5 to 9 digit ZIP-codes, etc.;
-
Property Address Parser (addresser), that has a helpful function .getRandomCity to simplify testing;
-
humanparser, helping to deal with names, salutations, and prefixes, and also address parsing functions.
To work with each one, you should enter "npm install ".
Shortly summing up for this method:
-
convenient for local services;
-
difficult to find a 100% suitable library;
-
a license may not allow commercial usage.
3. Online Parsers and Validator
If you don’t standardize many addresses daily or have a small number of them, look at this useful online tool. It allows to parse, standardize, and verify addresses online in minutes.
The mechanism is quite simple:
-
A user uploads a file with addresses (it can be Text, Excel, or CSV).
-
Map components (street, city, state, and others).
-
Tap "Start" and wait until addresses get parsed with the Geocoding API technology.
-
Download standardized and verified addresses.
However, you cannot verify large packages of addresses this way.
4. Geocoding API
Now let’s look at the most versatile and strong instrument for working with locations. Geocoding API provides the full cycle of operations: parsing, postal address normalization, validation, and verification.
The Geocoding APIs purpose is to show the most suitable existing place for each one entered. It is much more than just parsing, allowing to save time and effort for developers and improve the quality of operations.
For example, let’s look at a service from Geoapify. A useful basic feature is providing the level of confidence for each location.
-
CONFIRMED — for fully correct existing addresses with all required information;
-
PARTIALLY_CONFIRMED — up to a certain level, the address is correct, but there are mistakes;
-
NOT_CONFIRMED — the location does not exist, and you’ll receive the most alike one instead.
Also, you’ll see all related information: coordinates, all address components - house number, street, city, postcode, etc., and standardized address. The address entered initially will be tested and parsed, and verified.
Summarizing this method:
-
provides the most checked and full information, requires almost no additional attention;
-
still, working with non-confirmed addresses needs additional work and logic from developers;
-
performs all needed operations and works versatile with most of the countries, multi-language support;
-
usually is not free for large datasets.
Which One is the Best?
All stated technologies are different and suit various situations. If you have many free-form addresses, choose the Geocoding API to match all purposes at once. For certainly local projects, NPM-packages and regular expressions are also great. Also, try different ways of working and find the preferable one.
Founder of Geoapify. We offer maps, geocoding, routing, and other APIs to help you to build location-aware apps.
https://www.geoapify.com/geocoding-api/
Article source: https://articlebiz.comRate article
Article comments
There are no posted comments.
Related articles
- Master the Art of Gamification with Our Engaging App
- 10 Reasons Business Central Users Leverage Advanced Inventory Count
- The Ultimate Guide to 3D Animation: From Basics to Advanced Techniques
- Mitsubishi Electric proves heat pump compatibility with microbore pipework
- Google DeepMind Launches Gemma 2: A New AI Model Revolutionizing Research and Development
- How Do AI Solutions Drive Productivity And ROI In Business?
- Is Verizon Total the same as Verizon Prepaid?
- What is the best prepaid phone company?
- Why Small to Large Companies Continue to Use Dated/Dinosaur Technology
- 10 Ways Business Central’s Quality Inspector App Streamlines Quality Assurance
- 10 Ways Business Central’s Quality Inspector App Streamlines Quality Assurance
- The Rise of Sustainable Technology: Shaping a Greener Future
- Why Bullseye Engagement Offers the Best OKR Software for Businesses
- Web Development Companies in Canada
- How EasyPDF™ Forms Save Time & Money at Home and in the Workplace
- The One and Only 15-Second Digital Lien Waiver to Complete and Submit in Record Time Using the Free Adobe Reader
- The Impact of Employer Branding on Leadership Recruitment
- Augmented Reality (AR) in Business: Why Your Company Needs It
- Top 10 Reasons to Use Business Central’s License Plating App
- The Hidden Advantages of European Offshore Development Companies
- App Development: Transforming Ideas into Reality
- Automate you Chauffeur Service with A to Z Dispatch
- The Impact of Machine Learning and AI on Business: What the Future Holds In the modern busine
- Generate Flashcards Fast with AI: The Ultimate Solution for Developers
- Blockchain Interview Guide: Essential Questions and Answers for Success
- Eight Free Business Central Apps That You’ll Wish You Had
- How Artificial Intelligence (AI) and Machine Learning (ML) Are Transforming Computer-Based Trading Platforms
- The Role of Gas Engineers in Modern Energy Systems: Linking to Sustainability and Innovation
- The Significance of Stars in the Universe and Their Impact on Human Culture Throughout Evolution
- Exploiting Artificial Intelligence for Urban Mobility Transformation: A Case Study of Guatemala City