Implement Expo/React Native support and add forward geocoding#8
Open
sebschlo wants to merge 1 commit intolucaspiller:masterfrom
Open
Implement Expo/React Native support and add forward geocoding#8sebschlo wants to merge 1 commit intolucaspiller:masterfrom
sebschlo wants to merge 1 commit intolucaspiller:masterfrom
Conversation
…ration Add forward geocoding (geocoder.forward(query)) that does exact match with prefix/substring fallback, ranked by population. Requires a database generated with the updated schema — gracefully returns undefined on older databases missing the asciiname/population columns. Add Expo/React Native entrypoint (src/expo.js) that wraps expo-sqlite into the node-sqlite3 callback interface the existing modules expect. Decouple sqlite3 from index.js so it's lazily required only for Node usage. Add geonames:<id> support to location.find() for stable identifiers, and fix a copy-paste bug in location.js where callback was referenced but never defined. Switch named SQL params ($lat, $id) to positional (?) for cross-runtime compatibility with both sqlite3 and expo-sqlite. Update the database generation script with configurable feature codes, population filters, and admin1 toggle. Extract schema to scripts/schema.sql. Tests now use a fixture database instead of requiring the full data/ dir.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Add forward geocoding (geocoder.forward(query)) that does exact match with prefix/substring fallback, ranked by population. Requires a database generated with the updated schema — gracefully returns undefined on older databases missing the asciiname/population columns.
Add Expo/React Native entrypoint (src/expo.js) that wraps expo-sqlite into the node-sqlite3 callback interface the existing modules expect. Decouple sqlite3 from index.js so it's lazily required only for Node usage.
Add geonames: support to location.find() for stable identifiers, and fix a copy-paste bug in location.js where callback was referenced but never defined.
Switch named SQL params ($lat, $id) to positional (?) for cross-runtime compatibility with both sqlite3 and expo-sqlite.
Update the database generation script with configurable feature codes, population filters, and admin1 toggle. Extract schema to scripts/schema.sql.
Agent Usage
Note
This PR was kicked off by the following Codex 5.3 prompt, and then heavily reviewed, tested, and human-reworked.
You are working in a fork of offline-geocoder to make it production-usable from Expo/React Native (iOS + Android), not just Node.
Goal
Build a cross-platform offline geocoder library that:
Required changes
Constraints
Deliverables