nextcloud / nextcloud/maps

More Configuration Options for Maps App

Open
#1,502 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage enhancement
Dominant language
JavaScript
Stars
598
Forks
113
PR merge metrics
No merged PRs in 30d

Description

Hello, Nextcloud Developers,

I have been using the Nextcloud Maps app for years. It has been useful on many occassions. It has even assisted with real-time navigation, in instances where apps like Google Maps or Apple Maps failed. I eagerly await the update that makes the Maps app compatible with Nextcloud 32.

I recently encountered an issue (after extracting the latest maps for North America), where the Nextcloud Maps app was seemingly rate-limited by Nominatim. From what I've red, their service is being provided free-of-charge. But service hosting isn't free, and many people may be relying on this service. After a few days of tinkering, I ended up making a few minor changes to [AddressService.php]:

        private function lookupAddressExternal($adr): array {
                if (time() - intval($this->memcache->get('lastAddressLookup')) >= 3) {
                        $opts = [
                                'http' => [
                                        'method' => 'GET',
                                        'user_agent' => 'Internal Service Name (powered by Nextcloud)',
                                ]
                        ];
                        $context = stream_context_create($opts);

                        // we get rid of "post office box" field
                        $splitted_adr = explode(';', $adr);
                        if (count($splitted_adr) > 2) {
                                array_shift($splitted_adr);
                        }

                        // remove blank lines (#706)
                        $splitted_adr = array_filter(array_map('trim', $splitted_adr));
                        $query_adr = implode(', ', $splitted_adr);

                        $result_json = @file_get_contents(
                                'https://nominatim.openstreetmap.org/search.php?q=' . urlencode($query_adr) . '&format=jsonv2&email=admin@mail.txp-network.ml',
                                false,
                                $context
                        );

I'm not a developer, and these are not major changes. But this did seem to fix the issue I was having.

Would it be possible to make the changed variables configurable via the web UI?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading AddressService.php and the shown lookupAddressExternal method, then trace how Maps currently stores and exposes application settings. Identify the changed lookup values that should be configurable through the web UI, and consider the feature done when those settings can be managed there and are used by the address lookup.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
full-stack
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.