For developers of logistics or supply chain models, geocoding is an essential tool. The legacy GeoFindCoordinates function, while convenient, is limited by strict rate-limiting (typically 1 request per second).
To provide an alternative, which is almost plug and play, I’ve published a new technical How-To: https://how-to.aimms.com/Articles/684/684-LocationIQ.html.
Key features of this alternative:
- Library-Based Design: The implementation is encapsulated within a dedicated AIMMS Library. You can easily export the library and include it in your existing AIMMS projects without rewriting the core logic.
Existing calls to GeoFindCoordinates, can be replaced by liq:pr_GeoFindCoordinates. - REST Requests: Uses dex::client::NewRequest to handle HTTP GET requests.
- JSON-to-Identifier Mapping: Demonstrates how to use an AimmsJSONMapping file (XML) to automatically bind nested JSON arrays and objects (like lat, lon, and place_id) to AIMMS indexed parameters.
- Structured Error Handling: Includes logic to differentiate between CURL-level network errors (statusCode 0) and API-level exceptions (e.g., 401 Unauthorized or 429 Rate Limited), complete with JSON error-response parsing.
The sample project is available via github