### Install Address Dictionary File Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/command_line.md Installs a downloaded address database file to create an address database. The path to the downloaded file is a required parameter. The --db-dir option can specify the installation directory. ```bash jageocoder install-dictionary gaiku_all_v21.zip ``` -------------------------------- ### Get Installed Dictionary README Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Retrieves the content of the README.txt file associated with the installed dictionary. This can provide important information about the dataset. ```python >>> tree.installed_dictionary_readme() 'This is the README content...' ``` -------------------------------- ### Initialize Jageocoder and Get Tree Module Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Initializes the Jageocoder library and retrieves the module tree. This is a common setup step before interacting with the address data. ```python >>> import jageocoder >>> jageocoder.init() >>> tree = jageocoder.get_module_tree() ``` -------------------------------- ### Install Address Dictionary Database Source: https://github.com/t-sagara/jageocoder/blob/main/README.md After downloading, use the 'install-dictionary' command with the database file name to install it locally. This enables high-speed processing of large amounts of address data. ```bash jageocoder install-dictionary jukyo_all_20250423_v22.zip ``` -------------------------------- ### Get Installed Dictionary README Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Retrieves the content of the README.txt file associated with the installed address dictionary. The database directory can be specified, or it defaults to the one determined by get_db_dir(). ```python jageocoder.installed_dictionary_readme(db_dir: PathLike | None = None, url: str | None = None) -> str ``` -------------------------------- ### Get Installed Dictionary Version Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Retrieves the version string of the installed dictionary or the connected server. This helps in verifying compatibility and understanding the data source. ```python >>> tree.installed_dictionary_version() '20230101' ``` -------------------------------- ### Install Address Dictionary Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Installs an address dictionary from a specified zipped file path. Optionally, a database directory can be provided; otherwise, get_db_dir() is used. ```python jageocoder.install_dictionary(path: PathLike, db_dir: PathLike | None = None, skip_confirmation: bool = False) ``` -------------------------------- ### Get Installed Dictionary Version Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Retrieves the version string of the installed address dictionary or the Jageocoder server. The database directory can be specified, or it defaults to the one determined by get_db_dir(). ```python jageocoder.installed_dictionary_version(db_dir: PathLike | None = None, url: str | None = None) -> str ``` -------------------------------- ### jageocoder.installed_dictionary_version Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Gets the version string of the installed address dictionary or the Jageocoder server. ```APIDOC ## jageocoder.installed_dictionary_version ### Description Get the installed dictionary version. ### Parameters #### Path Parameters - **db_dir** (os.PathLike | None) - Optional - The directory where the database files has been installed. If omitted, it will be determined by get_db_dir(). - **url** (str | None) - Optional - URL of the Jageocoder server endpoint. ### Returns - **str** - The version string of the installed dicitionary or the server. ``` -------------------------------- ### jageocoder.install_dictionary Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Installs an address dictionary from a specified zipped file path. ```APIDOC ## jageocoder.install_dictionary ### Description Install address-dictionary from the specified path. ### Parameters #### Path Parameters - **path** (os.PathLike) - Required - The file path where the zipped address-dictionary file exists. - **db_dir** (os.PathLike | None) - Optional - The directory where the database files will be installed. If omitted, use get_db_dir() to decide the directory. - **skip_confirmation** (bool) - Optional (default=False) - Flag to skip confirmation prompts during installation. ``` -------------------------------- ### installed_dictionary_readme() Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Fetches the content of the README.txt file associated with the installed dictionary. ```APIDOC ## installed_dictionary_readme(db_dir: os.PathLike | None = None, url: str | None = None) ### Description Get the content of README.txt attached to the installed dictionary. ### Parameters #### Path Parameters - **db_dir** (os.PathLike | None) - Optional - The directory where the database files has been installed. If omitted, it will be determined by get_db_dir(). - **url** (str | None) - Optional - URL of the Jageocoder server endpoint. ### Returns - The content of the text. ``` -------------------------------- ### jageocoder.installed_dictionary_readme Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Retrieves the content of the README.txt file from the installed address dictionary. ```APIDOC ## jageocoder.installed_dictionary_readme ### Description Get the content of README.txt attached to the installed dictionary. ### Parameters #### Path Parameters - **db_dir** (os.PathLike | None) - Optional - The directory where the database files has been installed. If omitted, it will be determined by get_db_dir(). - **url** (str | None) - Optional - URL of the Jageocoder server endpoint. ### Returns - **str** - The content of the text. ``` -------------------------------- ### installed_dictionary_readme Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Retrieves the content of the README.txt file for the installed dictionary. ```APIDOC ## installed_dictionary_readme() ### Description Get the content of README.txt attached to the installed dictionary. ### Parameters * **db_dir** (*os.PathLike* *,* *optional*) – The directory where the database files has been installed. If omitted, it will be determined by get_db_dir(). * **url** (*str* *,* *optional*) – URL of the Jageocoder server endpoint. ### Returns The content of the text. ### Return type str ``` -------------------------------- ### Get Jageocoder Database Directory Source: https://github.com/t-sagara/jageocoder/blob/main/README.md This command displays the location of the installed dictionary database. This path can also be specified programmatically using 'jageocoder.get_db_dir()'. ```bash jageocoder get-db-dir ``` -------------------------------- ### installed_dictionary_version Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Retrieves the version of the installed dictionary or the server. ```APIDOC ## installed_dictionary_version() ### Description Get the installed dictionary version. ### Returns The version string of the installed dicitionary or the server. ### Return type str ``` -------------------------------- ### installed_dictionary_version() Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Retrieves the version of the installed dictionary or the server. ```APIDOC ## installed_dictionary_version() ### Description Get the installed dictionary version. ### Returns - The version string of the installed dictionary or the server. ``` -------------------------------- ### datasets Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Retrieves a dictionary of installed datasets on the server. ```APIDOC ## datasets ### Description Get list of datasets installed in the dictionary. ### Returns List of datasets. ### Return type Dict[int, Any] | None ``` -------------------------------- ### Example: Search Address Node Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Demonstrates how to initialize Jageocoder and use the searchNode function to find an address. The searchNode function returns the de-standardized string as the match string. ```python >>> import jageocoder >>> jageocoder.init() >>> jageocoder.searchNode('多摩市落合1-15-2') [{"node": {"id": ..., "name": "2", "name_index": "2.", "x": 139.4..., "y": 35.6..., "level": 8, "priority": 9, "note": "", "parent_id": ..., "sibling_id": ...}, "matched": "多摩市落合1-15-2"}] ``` -------------------------------- ### Get Parent List Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Returns a complete list of nodes starting from the prefecture down to the current node. ```python node.get_parent_list() # Returns: [, , ...] ``` -------------------------------- ### Get Full Address Notation Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Retrieves the full address notation. Specify a delimiter to get a string, or None to get a list of address elements. ```python node.get_fullname(delimiter='') # Returns: '東京都多摩市落合1丁目15番地' node.get_fullname() # Returns: ['東京都', '多摩市', '落合', '一丁目', '15番地'] ``` -------------------------------- ### Set Custom Jageocoder Database Directory Source: https://github.com/t-sagara/jageocoder/blob/main/README.md To install the dictionary in a custom location, set the JAGEOCODER_DB2_DIR environment variable before running the 'install-dictionary' command. ```bash export JAGEOCODER_DB2_DIR='/usr/local/share/jageocoder/db2' install-dictionary ``` -------------------------------- ### Get Notes Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Retrieves a list of key-value pairs from the node's note field. ```python node.get_notes() # Returns: (('aza_id', '0010001'), ('postcode', '2060033')) ``` -------------------------------- ### Set Jageocoder Server URL via Environment Variable Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Configure the Jageocoder client to connect to a specific server endpoint by setting the JAGEOCODER_SERVER_URL environment variable. This is useful for avoiding large local database installations. ```bash export JAGEOCODER_SERVER_URL=https://jageocoder.info-proto.com/jsonrpc ``` -------------------------------- ### get_parent_list Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Returns a complete node list starting with the prefecture. ```APIDOC ## get_parent_list() -> List[AddressNode] ### Description Returns a complete node list starting with the prefecture. ``` -------------------------------- ### Get Local Government Codes for Address Node Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Retrieve JISX0401 (2-digit prefecture) and JISX0402 (5-digit city) codes, as well as the 6-digit Local Government Code for an address node. ```python >>> node.get_city_jiscode() # 5-digit code '13104' >>> node.get_city_local_authority_code() # 6-digit code '131041' >>> node.get_pref_jiscode() # prefecture code '13' ``` -------------------------------- ### Get Google Maps Link Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Returns the URL for Google Maps with the node's coordinates. ```python node.get_googlemap_link() # Returns: 'https://maps.google.com/maps?q=35.667717,139.474377&z=18' ``` -------------------------------- ### parent (property) Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Gets the parent node of the current node. ```APIDOC ## parent ### Description Get the parent node of the node. ### Property - **parent** ([AddressNode](#jageocoder.node.AddressNode) | None): The parent object. Returns None when the parent node is the root node. ``` -------------------------------- ### get_fullname Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Returns a complete address notation starting with the name of the prefecture. Can return a string with a specified delimiter or a list of address elements. ```APIDOC ## get_fullname(delimiter: str | None = None, alt: str | None = '') -> str | List[str] ### Description Returns a complete address notation starting with the name of the prefecture. * **Parameters:** * **delimiter** (*str* *,* *optional*) – Specifies the delimiter character for the address element; If None is specified, returns a list of elements. * **alt** (*str* *,* *optional*) – String to be used instead if the node name is empty. * **Returns:** If a delimiter is specified (including “”), returns a string consisting of the name of the address node concatenated with the delimiter. Otherwise, it returns a list of address node names. * **Return type:** str, List[str] ``` -------------------------------- ### Get GSI Maps Link Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Returns the URL for GSI Maps with the node's coordinates. ```python node.get_gsimap_link() # Returns: 'https://maps.gsi.go.jp/#13/35.667717/139.474377/' ``` -------------------------------- ### Get Node Name Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Retrieves the name of the node. An alternative string can be provided if the node name is empty. ```python node.get_name() # Returns: '落合' node.get_name(alt='N/A') # Returns: 'N/A' if node name is empty ``` -------------------------------- ### Get Nodes by Level Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Returns a list containing the node and its upper nodes, indexed by address level. None is stored for levels without a corresponding element. ```python >>> import jageocoder >>> jageocoder.init() >>> node = jageocoder.searchNode('多摩市落合1-15')[0][0] >>> [str(x) for x in node.get_nodes_by_level()] ['None', "[{'id': ..., 'name': '東京都', 'x': 139.6..., 'y': 35.6..., 'level': 1, 'priority': 1, 'note': 'lasdec:130001/jisx0401:13', 'parent_id': 0, 'sibling_id': ..., 'fullname': ['東京都']}]", 'None', "[{'id': ..., 'name': '多摩市', 'x': 139.4..., 'y': 35.6..., 'level': 3, 'priority': 1, 'note': 'geoshape_city_id:13224A1971/jisx0402:13224/postcode:2060000', 'parent_id': ..., 'sibling_id': ..., 'fullname': ['東京都', '多摩市']}]", 'None', "[{'id': ..., 'name': '落合', 'x': 139.4..., 'y': 35.6..., 'level': 5, 'priority': 2, 'note': '', 'parent_id': ..., 'sibling_id': ..., 'fullname': ['東京都', '多摩市', '落合']}]", "[{'id': ..., 'name': '一丁目', 'x': 139.4..., 'y': 35.6..., 'level': 6, 'priority': 2, 'note': 'aza_id:0010001/postcode:2060033', 'parent_id': ..., 'sibling_id': ..., 'fullname': ['東京都', '多摩市', '落合', '一丁目']}]", "[{'id': ..., 'name': '15番地', 'x': 139.4..., 'y': 35.6..., 'level': 7, 'priority': 3, 'note': '', 'parent_id': ..., 'sibling_id': ..., 'fullname': ['東京都', '多摩市', '落合', '一丁目', '15番地']}]"] ``` -------------------------------- ### Get Prefecture Local Authority Code Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Returns the local authority code of the prefecture containing this node. ```python node.get_pref_local_authority_code() # Returns: '13000' ``` -------------------------------- ### Get Prefecture JIS Code Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Returns the JIS X 0401 code of the prefecture containing this node. ```python node.get_pref_jiscode() # Returns: '13000' ``` -------------------------------- ### Get Node by ID Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Retrieves the full information for an address node given its unique ID. This is useful for fetching detailed data about a specific address component. ```python >>> tree.get_node_by_id(100000000) ... ``` -------------------------------- ### Get GeoJSON Representation of Address Node Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Obtain the GeoJSON representation of an address or address node using the `as_geojson()` method. ```python >>> results[0].as_geojson() {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [139.6917724609375, 35.68962860107422]}, 'properties': {'id': 80223284, 'name': '8番', 'level': 7, 'priority': 3, 'note': '', 'parent_id': 80223179, 'sibling_id': 80223285, 'fullname': ['東京都', '新宿区', '西新宿', '二丁目', '8番'], 'matched': '新宿区西 新宿2-8-'}} >>> results[0].node.as_geojson() {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [139.6917724609375, 35.68962860107422]}, 'properties': {'id': 80223284, 'name': '8番', 'level': 7, 'priority': 3, 'note': '', 'parent_id': 80223179, 'sibling_id': 80223285, 'fullname': ['東京都', '新宿区', '西新宿', '二丁目', '8番']}} ``` -------------------------------- ### Initialize Jageocoder API Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Import the jageocoder library and call the init() function to prepare it for use. This can be done without parameters if environment variables are set, or with 'db_dir' or 'url' parameters to specify the database location or server endpoint. ```python >>> import jageocoder >>> jageocoder.init() ``` -------------------------------- ### Initialize Jageocoder and Search Address Node Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Initializes the Jageocoder module and demonstrates searching for an address node using its searchNode method. Requires the jageocoder library to be imported. ```python import jageocoder jageocoder.init() tree = jageocoder.get_module_tree() tree.searchNode('多摩市落合1-15-2') ``` -------------------------------- ### levelname (property) Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Gets the level name of the node. ```APIDOC ## levelname ### Description Get level by name. ### Property - **levelname** (str) ``` -------------------------------- ### Display Jageocoder Help Information Source: https://github.com/t-sagara/jageocoder/blob/main/README.md View available commands and options for the Jageocoder command-line interface by running the '--help' command. ```bash jageocoder --help ``` -------------------------------- ### Initialize Jageocoder Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Initializes the module-level AddressTree object for use. Prioritizes db_dir over url if both are specified. If neither is provided, it attempts to find a dictionary within the jageocoder package directory. ```python jageocoder.init(db_dir: PathLike | None = None, mode: str = 'r', debug: bool | None = None, url: str | None = None, **kwargs) ``` -------------------------------- ### jageocoder.init Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Initializes the module-level AddressTree object for use. This function must be called before most other Jageocoder functions. ```APIDOC ## jageocoder.init ### Description Initialize the module-level AddressTree object jageocoder.tree ready for use. ### Parameters #### Path Parameters - **db_dir** (os.PathLike | None) - Optional - The database directory. ‘address.db’ and ‘address.trie’ are stored in this directory. - **mode** (str) - Optional (default='r') - Specifies the mode for opening the database. 'a' for append/create, 'w' for overwrite, 'r' for read-only. - **debug** (bool | None) - Optional (default=False) - Debugging flag. - **url** (str | None) - Optional - URL of the Jageocoder server endpoint. ### Notes - If both ‘db_dir’ and ‘url’ are specified, ‘db_dir’ has priority. - If both ‘db_dir’ and ‘url’ are omitted, it looks for a dictionary installed in the jageocoder package directory. If not found, a ‘JageocoderError’ exception is thrown. ``` -------------------------------- ### Initialize and Search Address with Jageocoder Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Basic usage involves initializing the geocoder with a server URL and then calling the search function with an address string. The result is a dictionary containing matched address parts and candidate geocoding results. ```python >>> import jageocoder >>> jageocoder.init(url='https://jageocoder.info-proto.com/jsonrpc') >>> jageocoder.search('新宿区西新宿2-8-1') {'matched': '新宿区西新宿2-8-', 'candidates': [{'id': 5961406, 'name': '8番', 'x': 139.691778, 'y': 35.689627, 'level': 7, 'note': None, 'fullname': ['東京都', '新宿区', '西新宿', '二丁目', '8番']}]} ``` -------------------------------- ### Get Postcode Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Returns the 7-digit postcode of the oaza containing this node. ```python node.get_postcode() # Returns: '2060033' ``` -------------------------------- ### Download Address Dictionary Database Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Use the 'download-dictionary' command to fetch a compatible address database file. Ensure the URL points to a valid database archive. ```bash jageocoder download-dictionary https://www.info-proto.com/static/jageocoder/20250423/v2/jukyo_all_20250423_v22.zip ``` -------------------------------- ### List Datasets in Address Database Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/command_line.md Displays a list of datasets contained within the address database. Options include specifying the debug flag (-d), the database directory (--db-dir), or a Jageocoder server endpoint URL (-url). ```bash jageocoder list-datasets ``` -------------------------------- ### RemoteTree Initialization Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Initializes the RemoteTree class to connect to a remote Jageocoder server. ```APIDOC ## jageocoder.remote.RemoteTree ### Description The proxy class for remote server’s address-tree structure. ### Parameters * **db_dir** (*PathLike* *,* *optional*) – The directory where the database files has been installed. If omitted, it will be determined by get_db_dir(). * **mode** (*str*) – Mode for opening the database, defaults to 'r' (read-only). * **url** (*str* *,* *optional*) – Endpoint URL of the currently connected server. * **args, kwargs** – Additional arguments. ### Properties * **url** (str): Endpoint URL of the currently connected server. * **debug** (bool): Debug mode flag. * **address_nodes** (jageocoder.remote.RemoteNodeTable): A table that manages nodes information on the server. * **config** (dict): Current ‘search_config’ settings. ### Initializer #### __init__(url: str | None = None, debug: bool | None = False, **kwargs) -> None The initializer. * **Parameters**: * **url** (*str*) – The endpoint URL to the connecting server. * **debug** (*bool* *,* *optional* *(**default=False* *)*) – Debugging flag. If set to True, write debugging messages. ``` -------------------------------- ### jageocoder.version Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Returns the version of the Jageocoder package. ```APIDOC ## jageocoder.version() ### Description Returns the version of this package. ``` -------------------------------- ### Get Parent Node Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Retrieves the parent node. Returns None if the current node is directly under the root. ```python node.get_parent() # Returns: ``` -------------------------------- ### Check Initialization Status Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Checks if the Jageocoder module has been successfully initialized using the init() function. ```python jageocoder.is_initialized() -> bool ``` -------------------------------- ### Get MachiAza ID Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Returns the MachiAza ID defined by JDA address-base-registry for this node. This method is an alias for 'get_aza_id'. ```python node.get_machiaza_id() # Returns: '0010001/0010001' ``` -------------------------------- ### root() Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Generates the root AddressNode object. ```APIDOC ## root() ### Description Generate the root AddressNode object. ### Method CLASS METHOD ### Endpoint N/A (Class method) ### Returns - **[AddressNode](#jageocoder.node.AddressNode)**: The root AddressNode object. ``` -------------------------------- ### Download Address Dictionary File Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/command_line.md Downloads an address database file from a specified URL. Use this when curl or wget are unavailable. The URL is a required parameter. ```bash jageocoder download-dictionary https://www.info-proto.com/static/jageocoder/latest/v2/gaiku_all_v21.zip ``` -------------------------------- ### Get Omissible Index Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Obtains an optional leading substring from the search string index. This method can only be called from nodes in LocalTree. ```python node.get_omissible_index(index='15番地', processed_nodes=set()) # Returns: '15' ``` -------------------------------- ### search_by_prefcode(code) Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Finds address nodes using JISX0401 or prefecture local-government codes. ```APIDOC ## search_by_prefcode(code: str) -> list ### Description Finds the corresponding address nodes from the JISX0401 code or the prefecture’s local-government code. ### Parameters #### Path Parameters - **code** (str) - Prefacture code as defined in JISX0401, or local government code defined by MIC. ### Returns - A list of AddressNode objects. ### Notes - If “code” is 2 characters, the code is considered the JISX0401 code. - If “code” is 6 characters, the code is considered the local-govenment code. ``` -------------------------------- ### jageocoder.is_initialized Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Checks if the Jageocoder module has been initialized using the init() function. ```APIDOC ## jageocoder.is_initialized ### Description Checks if the module has been initialized with init(). ### Returns - **bool** - True if the module is initialized, otherwise False. ``` -------------------------------- ### Get Omissible Children Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Creates a list of omissible child nodes, referencing Aza-master. This method can only be called from nodes in LocalTree. ```python node.get_omissible_children() # Returns: [] ``` -------------------------------- ### create_note_index_table Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Collects notes from all address elements and creates a search table with an index. ```APIDOC ## create_note_index_table() ### Description Collect notes from all address elements and create search table with index. ### Return type None ``` -------------------------------- ### get_version() Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Retrieves the version of the tree file used by Jageocoder. ```APIDOC ## get_version() ### Description Get the version of the tree file. ### Returns - The version string. ``` -------------------------------- ### jageocoder.set_search_config Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Sets configurable search parameters for Jageocoder. ```APIDOC ## jageocoder.set_search_config(**kwargs) ### Description Set configurable search parameters. ### Parameters #### Query Parameters - **best_only** (bool) - Optional - If set to False, returns all search result candidates whose prefix matches. (default = True) - **aza_skip** (bool, None) - Optional - Specifies how to skip aza-names while searching nodes. If None, make the decision automatically. If False, do not skip. If True, always skip. (default = False) - **require_coordinates** (bool) - Optional - If set to False, nodes without coordinates are also included in the search. (default = True) - **target_area** (List[str]) - Optional - Specify the areas to be searched. The area can be specified by the list of name of the node (such as prefecture name or city name), or JIS code. (Default = []) - **auto_redirect** (bool) - Optional - When this option is set and the retrieved node has a new address recorded in the “ref” attribute, the new address is retrieved automatically. (default = True) ``` -------------------------------- ### jageocoder.search_by_prefcode Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Finds address nodes using a prefecture code (JISX0401 or local government code). ```APIDOC ## jageocoder.search_by_prefcode(code: str) ### Description Finds the corresponding address nodes from the JISX0401 code or the prefacture’s local-government code. ### Parameters #### Path Parameters - **code** (str) - Required - Prefacture code as defined in JISX0401, of local government code defined by MIC. ### Notes - If “code” is 2 characters, the code is considered the JISX0401 code. - If “code” is 6 characters, the code is considered the local-govenment code. ``` -------------------------------- ### Generate Map Link URLs for Address Node Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Create URLs to view the address location on GSI Maps and Google Maps. ```python >>> node.get_gsimap_link() 'https://maps.gsi.go.jp/#16/35.689627/139.691778/' >>> node.get_googlemap_link() 'https://maps.google.com/maps?q=35.689627,139.691778&z=16' ``` -------------------------------- ### Geocode Address from Command Line Source: https://github.com/t-sagara/jageocoder/blob/main/README.md A simple command-line interface is provided for geocoding addresses. This is useful for quick lookups or scripting. ```bash jageocoder search 新宿区西新宿2-8-1 ``` -------------------------------- ### search_by_prefcode Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Finds the corresponding address nodes from the JISX0401 code or the prefecture’s local-government code. ```APIDOC ## search_by_prefcode(code: str) ### Description Finds the corresponding address nodes from the JISX0401 code or the prefecture’s local-government code. ### Parameters #### Query Parameters - **code** (str) - Required - Prefacture code as defined in JISX0401, of local government code defined by MIC. If the code is 2 characters, it's considered JISX0401. If 6 characters, it's considered local-government code. ### Return type List[[AddressNode](api_node.md#jageocoder.node.AddressNode)] ``` -------------------------------- ### to_record() Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Converts the AddressNode object into a dictionary suitable for database insertion. ```APIDOC ## to_record() ### Description Convert from the AddressNode object to an object of dict that can be registered to the AddressNodeTable table. ### Method GET (conceptual) ### Endpoint N/A (Method of an object) ### Returns - **dict**: A dictionary representing the node record for database insertion. ``` -------------------------------- ### jageocoder.uninstall_dictionary Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Uninstalls the address dictionary. ```APIDOC ## jageocoder.uninstall_dictionary(db_dir: PathLike | None = None) ### Description Uninstall address-dictionary. ### Parameters #### Path Parameters - **db_dir** (os.PathLike | None) - Optional - The directory where the database files has been installed. If omitted, it will be determined by get_db_dir(). ``` -------------------------------- ### Uninstall Address Dictionary Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/command_line.md Uninstalls (removes) the address database. The --db-dir option can specify the directory of the address database to remove. This command will remove the specified directory and its contents. ```bash jageocoder uninstall-dictionary ``` -------------------------------- ### Explore Address Node Attributes Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Use `searchNode()` to retrieve detailed information about an address. The results provide access to the address node and its properties. ```python >>> results = jageocoder.searchNode('新宿区西新宿2-8-1') >>> len(results) 1 >>> results[0].matched '新宿区西新宿2-8-' >>> type(results[0].node) >>> node = results[0].node >>> node.get_fullname() ['東京都', '新宿区', '西新宿', '二丁目', '8番'] ``` -------------------------------- ### Traverse Child Nodes in Jageocoder Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Demonstrates how to access and list the names of child nodes from a parent address node. This is useful for exploring hierarchical address data. ```python >>> type(parent.children) >>> len(parent.children) 50 >>> [child.name for child in parent.children] ['1番', '1番地', '10番', '10番地', '11番', '11番地', '12番地', '134番地', '135番地', '136番地', '139番地', '140番地', '141番地', '145番地', '158番地', '174番地', '178番地', '181番地', '2番', '2番地', '3番', '3番地', '308番地', '309番地', '310番地', '311番地', '313番地', '314番地', '315番地', '318番地', '4番', '4番地', '5番', '5番地', '6番', '6番地', '673番地', '674番地', '7番', '7番地', '705番地', '708番地', '710番地', '733番地', '734番地', '735番地', '8番', '8番地', '9番', '9番地'] ``` -------------------------------- ### jageocoder.search Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Searches for address nodes in the tree based on a query string. ```APIDOC ## jageocoder.search ### Description Search node from the tree by the query. ### Parameters #### Path Parameters - **query** (str) - Required - An address notation to be searched. ### Returns - **Dict[str, Any] | List[Dict[str, Any]]** - A dict containing the following elements: **matched** (str) - The matching substring. **candidates** (list of dict) - List of dict representation of nodes with the longest match to the query string. ``` -------------------------------- ### Reverse Geocoding: Search Address by Coordinates Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Use the `reverse()` function to find addresses associated with a given latitude and longitude. The `level` parameter can specify the search depth. ```python >>> import jageocoder >>> jageocoder.init() >>> triangle = jageocoder.reverse(139.6917, 35.6896, level=7) >>> if len(triangle) > 0: ... print(triangle[0]['candidate']['fullname']) ... ['東京都', '新宿区', '西新宿', '二丁目', '8番'] ``` -------------------------------- ### Search Address Node by Query Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Searches for address nodes corresponding to a given address notation. Returns a list of AddressNode objects and the matched substring. Useful for geocoding addresses. ```python >>> tree.searchNode('多摩市落合1-15-2') [{"node": {"id": ..., "name": "2", "name_index": "2.", "x": 139.4..., "y": 35.6..., "level": 8, "priority": 9, "note": "", "parent_id": ..., "sibling_id": ...}, "matched": "多摩市落合1-15-2"}] ``` -------------------------------- ### get_pref_jiscode Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Returns the jisx0401 code of the prefecture that contains this node. ```APIDOC ## get_pref_jiscode() -> str ### Description Returns the jisx0401 code of the prefecture that contains this node. ``` -------------------------------- ### Search for latitude and longitude by address Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Use the `search()` function to find the latitude and longitude of a given address. It returns matched strings and a list of candidate addresses. ```APIDOC ## Search for latitude and longitude by address ### Description Use `search()` to search for the address you want to check the longitude and latitude of. The `search()` function returns a dict with `matched` as the matched string and `candidates` as the list of search results. (The results are formatted for better viewing) Each element of `candidates` contains the information of an address node (AddressNode). ### Method ```python jageocoder.search('新宿区西新宿2-8-1') ``` ### Response Example ```json { "matched": "新宿区西新宿2-8-", "candidates": [{ "id": 12299846, "name": "8番", "x": 139.691778, "y": 35.689627, "level": 7, "note": null, "fullname": ["東京都", "新宿区", "西新宿", "二丁目", "8番"] }] } ``` ### AddressNode Information - id: ID in the database - name: Address notation - x: longitude - y: latitude - level: Address level (1:Prefecture, 2:County, 3:City and 23 district, 4:Ward, 5:Oaza, 6:Aza and Chome, 7:Block, 8:Building) - note: Notes such as city codes - fullname: List of address notations from the prefecture level to this node ``` -------------------------------- ### json_request Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Makes a JSON request to the remote server with a specified method and parameters. ```APIDOC ## json_request(method: str, params: object) ### Description Sends a JSON request to the remote server. ### Parameters * **method** (*str*) – The method to call on the remote server. * **params** (*object*) – The parameters for the method call. ### Return type Any ``` -------------------------------- ### jageocoder.search_aza_record_by_code Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Searches for an Address-base-registry’s aza record using a Machi-aza code. ```APIDOC ## jageocoder.search_aza_record_by_code ### Description Search Address-base-registry’s aza record. ### Parameters #### Path Parameters - **code** (str) - Required - Machi-aza code in ABR. ### Returns - **dict** - The Aza record. ``` -------------------------------- ### jageocoder.searchNode Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Searches for address nodes corresponding to an address notation and returns the matching substring and a list of nodes. ```APIDOC ## jageocoder.searchNode ### Description Searches for address nodes corresponding to an address notation and returns the matching substring and a list of nodes. ### Parameters #### Path Parameters - **query** (str) - Required - An address notation to be searched. ### Returns - **list** - A list of AddressNode and matched substring pairs. ### NOTE The search_by_trie function returns the standardized string as the match string. In contrast, the searchNode function returns the de-starndized string. ### Example ```pycon >>> import jageocoder >>> jageocoder.init() >>> jageocoder.searchNode('多摩市落合1-15-2') [{"node": {"id": ..., "name": "2", "name_index": "2.", "x": 139.4..., "y": 35.6..., "level": 8, "priority": 9, "note": "", "parent_id": ..., "sibling_id": ...}, "matched": "多摩市落合1-15-2"}] ``` ``` -------------------------------- ### Search Address by Latitude and Longitude Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Use the `search()` function to find the latitude and longitude for a given address. It returns a dictionary with the matched string and a list of search results. ```python >>> jageocoder.search('新宿区西新宿2-8-1') { 'matched': '新宿区西新宿2-8-', 'candidates': [{ 'id': 12299846, 'name': '8番', 'x': 139.691778, 'y': 35.689627, 'level': 7, 'note': None, 'fullname': ['東京都', '新宿区', '西新宿', '二丁目', '8番'] }] } ``` -------------------------------- ### set_notes(notes) Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_node.md Sets the note field from a list of key-value pairs. ```APIDOC ## set_notes(notes) ### Description Set the note field from the list of key-value set. ### Method POST (conceptual) ### Endpoint N/A (Method of an object) ### Parameters #### Request Body - **notes** (Sequence[Tuple[str, str]]) - Required - List of key-value set (as tuples). ``` -------------------------------- ### jageocoder.search_by_postcode Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Finds an address node using a postcode. ```APIDOC ## jageocoder.search_by_postcode(code: str) ### Description Finds the corresponding address node from a postcode. ### Parameters #### Path Parameters - **code** (str) - Required - The postal code as defined by the Japan Post. ### Notes - The “code” must be 7 characters. ``` -------------------------------- ### search(query, **kwargs) Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Searches for addresses based on a query string. ```APIDOC ## search(query: str, **kwargs) -> list ### Description Searches for addresses based on a query string and additional keyword arguments. ``` -------------------------------- ### Count Records in Database Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Returns the total number of records present in the address database. This can be useful for understanding the scale of the data. ```python >>> tree.count_records() 123456 ``` -------------------------------- ### search_by_citycode(code) Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Finds address nodes using JISX0402 or local-government city codes. ```APIDOC ## search_by_citycode(code: str) -> list ### Description Finds the corresponding address nodes from the JISX0402 code or the local-government code. ### Parameters #### Path Parameters - **code** (str) - City code as defined in JISX0402, or local government code defined by MIC. ### Returns - A list of AddressNode objects. ### Notes - If “code” is 5 characters, the code is considered the JISX0401 code. - If “code” is 6 characters, the code is considered the local-govenment code. ``` -------------------------------- ### Explore the attribute information of an address Source: https://github.com/t-sagara/jageocoder/blob/main/README.md Retrieve detailed information about an address using `searchNode()`. This function returns a list of `Result` objects, each containing an `AddressNode`. ```APIDOC ## Explore the attribute information of an address ### Description Use `searchNode()` to retrieve information about an address. This function returns a list of type `jageocoder.result.Result`. You can access the address node from the `node` element of the `Result` object. ### Method ```python results = jageocoder.searchNode('新宿区西新宿2-8-1') ``` ### Example Usage ```python len(results) results[0].matched type(results[0].node) node = results[0].node node.get_fullname() ``` ### Result Object Attributes - **matched**: The matched string. - **node**: An `AddressNode` object containing address details. ### AddressNode Methods - **as_geojson()**: Returns the GeoJSON representation of the address node. - **get_city_jiscode()**: Returns the 5-digit JISX0402 city code. - **get_city_local_authority_code()**: Returns the 6-digit local government code. - **get_pref_jiscode()**: Returns the 2-digit prefecture code. - **get_gsimap_link()**: Generates a URL to link to GSI maps. - **get_googlemap_link()**: Generates a URL to link to Google Maps. - **parent**: Attribute to access the parent address node. ### GeoJSON Representation Example ```python results[0].as_geojson() results[0].node.as_geojson() ``` ### Local Government Codes Example ```python node.get_city_jiscode() # '13104' node.get_city_local_authority_code() # '131041' node.get_pref_jiscode() # '13' ``` ### Map Link Example ```python node.get_gsimap_link() node.get_googlemap_link() ``` ### Traverse Parent Node Example ```python parent = node.parent parent.get_fullname() parent.x, parent.y ``` ``` -------------------------------- ### Search ABR Az a Record by Code Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Searches for an Address-base-registry's aza record using a Machi-aza code. ```python jageocoder.search_aza_record_by_code(code: str) -> dict ``` -------------------------------- ### reverse(x, y, level, as_dict) Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Performs reverse geocoding for a given longitude and latitude. ```APIDOC ## reverse(x: float, y: float, level: int | None = None, as_dict: bool | None = True) -> list ### Description Reverse geocoding. ### Parameters #### Path Parameters - **x** (float) - Longitude of the point. - **y** (float) - Latitude of the point. - **level** (int | None) - Optional - Target node level. - **as_dict** (bool | None) - Optional, default=True - If True, returns candidates as dict objects. ### Returns - A list of candidates, where each candidate is a dict containing an AddressNode and its distance. ``` -------------------------------- ### search_by_postcode(code) Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Finds address nodes using a Japanese postal code. ```APIDOC ## search_by_postcode(code: str) -> list ### Description Finds the corresponding address node from a postcode. ### Parameters #### Path Parameters - **code** (str) - The postal code as defined by the Japan Post. ### Returns - A list of AddressNode objects. ### Notes - The “code” must be 7 characters. ``` -------------------------------- ### jageocoder.reverse Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_module.md Performs reverse geocoding to find addresses corresponding to given coordinates. ```APIDOC ## jageocoder.reverse ### Description Reverse geocoding. ### Parameters #### Path Parameters - **x** (float) - Required - Longitude of the point. - **y** (float) - Required - Latitude of the point. - **level** (int | None) - Optional - Target node level. - **as_dict** (bool) - Optional (default=True) - If True, returns candidates as dict objects. ### Returns - **list** - The result list contains up to 3 nodes. Each element is a dict type with the following structure: {“candidate”:AddressNode, “dist”:float} ``` -------------------------------- ### Search Address Nodes by City Code Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Finds corresponding address nodes using either a JISX0402 code (5 characters) or a local-government code (6 characters). ```python >>> tree.search_by_citycode('13101') ... ``` -------------------------------- ### searchNode(query) Source: https://github.com/t-sagara/jageocoder/blob/main/docs/source/api_tree.md Searches for address nodes corresponding to an address notation and returns matching substrings and nodes. ```APIDOC ## searchNode(query: str) -> list ### Description Searches for address nodes corresponding to an address notation and returns the matching substring and a list of nodes. ### Parameters #### Path Parameters - **query** (str) - An address notation to be searched. ### Returns - A list of AddressNode and matched substring pairs. ### Example ```pycon >>> import jageocoder >>> jageocoder.init() >>> tree = jageocoder.get_module_tree() >>> tree.searchNode('多摩市落合1-15-2') [{"node": {"id": ..., "name": "2", "name_index": "2.", "x": 139.4..., "y": 35.6..., "level": 8, "priority": 9, "note": "", "parent_id": ..., "sibling_id": ...}, "matched": "多摩市落合1-15-2"}] ``` ```