Skip to content

More Configuration Options for Maps AppΒ #1502

@TopHatProductions115new

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions