PHPackages                             equi/opengeodb-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. equi/opengeodb-laravel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

equi/opengeodb-laravel
======================

Package for the OpengeoDB

1.0.5(9y ago)23401CC-BY-ND-3.0PHPPHP &gt;=5.5.9

Since Oct 30Pushed 9y ago1 watchersCompare

[ Source](https://github.com/thejoe8495/opengeodb-laravel)[ Packagist](https://packagist.org/packages/equi/opengeodb-laravel)[ RSS](/packages/equi-opengeodb-laravel/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)DependenciesVersions (3)Used By (0)

Opengeodb Laravel
=================

[](#opengeodb-laravel)

[![Creative Commons Lizenzvertrag](https://camo.githubusercontent.com/1f70a45199aae07cbe593e3cc47d2a5134c13555948dea18a3d3b3d1be8b51b9/68747470733a2f2f692e6372656174697665636f6d6d6f6e732e6f72672f6c2f62792d6e642f332e302f64652f38387833312e706e67)](http://creativecommons.org/licenses/by-nd/3.0/de/)
Dieses Werk ist lizenziert unter einer [Creative Commons Namensnennung-Keine Bearbeitung 3.0 Deutschland Lizenz](http://creativecommons.org/licenses/by-nd/3.0/de/).

Über
----

[](#über)

Installieren
------------

[](#installieren)

### Composer /Artisan

[](#composer-artisan)

entweder

```
composer require equi/opengeodb-laravel

```

oder in die composer.json die Zeile "equi/opengeodb-laravel": "~1.0", hinzufügen

```
    ...
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        ....
        "equi/opengeodb-laravel": "~1.0",
        ...
    },
    ...

```

Beim manuellen Updaten noch den Befehl ausführen

```
composer update

```

in die /config/app.php im Array "providers" diese Zeile einfügen

```
        Equi\Opengeodb\OpengeodbServiceprovider::class,

```

anschließend default configs/migrations/.. in den /app Ordner kopieren.

```
php artisan vendor:publish

```

### Fehlende Dateien suchen

[](#fehlende-dateien-suchen)

[OpenGeoDB](http://opengeodb.giswiki.org/wiki/OpenGeoDB) -&gt; [Downloads](http://www.fa-technik.adfc.de/code/opengeodb/)

#### Welche Dateien braucht ihr?

[](#welche-dateien-braucht-ihr)

Pflicht:

```
opengeodb-end.sql
opengeodb_hier.sql
changes.sql

```

Optional je Nachdem welches Land ihr benötigt paarweiße laden:

```
AT.sql
AThier.sql
BE.sql
BEhier.sql
CH.sql
CHhier.sql
DE.sql
DEhier.sql
LI.sql
LIhier.sql
Extra.sql    // &Uuml;bergeordnete inhalte (Europa, Amerika, ...) und dazugeh&ouml;rige Sprachen (Deutschland = Germany ...)

```

Die Dateien scheinen veraltet diese werden aber in changes.sql aktualisiert

#### wohin damit?

[](#wohin-damit)

Standardmäßig unter **/Storage/app/opengeodb/sql** oder den festgelegten Ordner in der Config unter **storageopengodbsql**

### Konfiguration config/opengeodb.php

[](#konfiguration-configopengeodbphp)

```
return [
    // Storage/app/.....
    'storagemap' => "/opengeodb/map",
    'storagee00' => "/opengeodb/e00",
    'storageopengodbsql' => "/opengeodb/sql",

    'mapcolor' => [
        'black'=>[0, 0, 0],
        'white'=>[255, 255, 255],
        'Therme'=>[255, 0, 0],
        'Freizeitbad'=>[178, 237, 90],
        'Sauna'=>[148, 208, 255],
        'Anderes Bad'=>[148, 208, 255],
        'Bad'=>[148, 208, 255],
        'Hallenbad'=>[148, 208, 255],
        'yellow'=>[148, 208, 255],
        'pink'=>[148, 208, 255],

        'land'=>[20, 20, 20],
        'bund'=>[125, 125, 125],
        'kreis'=>[200, 200, 200],
    ],

    'incresscolor' => 'black',

    'radiusdata' => [
        1 => 7,
        2 => 10,
        5 => 14,
    ]

];

```

### Datenbanken erstellen und füllen

[](#datenbanken-erstellen-und-füllen)

```
composer dump-autoload
php artisan migrate
php artisan db:seed --class=OpengeodbSeeder

```

Für manche PHP Konfiguration ist die de.sql zu groß hierfür könnt ihr folgendes versuchen:

```
php -d memory_limit=256M artisan db:seed --class=OpengeodbSeeder

```

Einbinden/Benutzen
------------------

[](#einbindenbenutzen)

### Karte zeichnen

[](#karte-zeichnen)

Das Beispiel zeigt ein Controller der in der routes.php auf /Karte/ reagiert.

```
namespace App\Http\Controllers;

use App\Http\Requests;
use Illuminate\Http\Request;
use App\Models\Thermal;
use Equi\Opengeodb\Map\GeoMap;
use Equi\Opengeodb\Models\GeodbMapcoord;
use Equi\Opengeodb\Models\GeodbTextdata;

class MapController extends Controller
{

    public function getIndex() {
        $this->_data["result"] = "";
        $this->_data["ready"] = "";
        $this->_data["js"] = "";
        $this->_data["demaps"] = GeodbTextdata::where("loc_id", "105")->first()->GeodbMapcoords();
        $this->_data["atmaps"][] = GeodbMapcoord::where("loc_id", "106")->first();
        $this->_data["chmaps"][] = GeodbMapcoord::where("loc_id", "107")->first();
        $this->_data["title"] = \Lang::get("map.titlemap");
        $this->_data["description"] = \Lang::get("map.descriptionmap");
        return view('maps/map', $this->_data);
    }

    public function getShow($loc_id){
        return $this->zeichnethumb($loc_id);
    }

    public function getJson($loc_id){
        $map = $this->zeichne($loc_id);
        $data = $map->getArrayMapdata();
        for($i=0;$i < count($data); $i++){
            $datalinks = "";
            foreach($data[$i]["objects"] as $object){
                $datalinks .= "" . $object->name . " (" . $object->stadt . ")";
            }
            $data[$i]["objects"] = $datalinks;
        }
        return \Response::json(["data" => $data, "id" => $loc_id])->header('Content-Type', 'json');
    }

    public function getShowbig($loc_id){
        $map = $this->zeichne($loc_id);
        return \Response::make(\Storage::get($map->getImagePath()))->header('Content-Type', 'image/png');
    }

    public function postSearchloc(Request $request){
        $geo = new GeodbMaster();
        $geo->searchByName($request->get("search"));
        $geo->searchByPLZ($request->get("search"));
        $geodat = $geo->get();
        $json = [];
        foreach($geodat as $onecit){
            $city["loc_id"] = $onecit->loc_id;
            $city["name"] = $onecit->name();
            $city["plz"] = $onecit->plz();
            $json[] = $city;
        }
        return $json;
    }

    private function zeichne($loc_id){
        if ($loc_id != 104)
            $map = new GeoMap($loc_id, 1090);
        else{
            $map = new GeoMap();
            $map->createEmptyMapAfterLoc_id($loc_id, 1090);
            $map->addDataFile("/105-bund.e00", "bund");
            $map->addDataFile("/105.e00", "land");
            $map->addDataFile("/106.e00", "land");
            $map->addDataFile("/107.e00", "land");
        }

        if (!$map->mapalreadyexists()) {
            $thermen = Thermal::all();
            foreach($thermen as $therme){
                $map->addGeoObjectIncrease($therme->lon, $therme->lat, $therme->id, $therme, $therme->artbad);
            }
            $map->saveMapJson();
            $map->saveImage();
        }
        return $map;
    }

    private function zeichnethumb($loc_id){
        $image = \Config::get('opengeodb.storagemap')."thumb/" . $loc_id . ".png";
        if(\Storage::exists($image)) {
            return \Response::make(\Storage::get($image))->header('Content-Type', 'image/png');
        }elseif ($loc_id == 104){
            $map = new GeoMap();
            $map->createEmptyMapAfterLoc_id($loc_id, 350);
            $map->addDataFile("/105.e00", "land");
            $map->addDataFile("/106.e00", "land");
            $map->addDataFile("/107.e00", "land");
            $map->saveImage(storage_path("app". $image ));
        }else if (!\Storage::exists($image)) {
            $map = new GeoMap();
            $map->createMapAfterLoc_id($loc_id, 250);
            $map->saveImage(storage_path("app". $image ));
        }
        return \Response::make(\Storage::get($image))->header('Content-Type', 'image/png');
    }

}

```

Dies ist mein aktueller weg um die Ladezeiten gering zu halten. Die Punkte sind in der map.blade.php:

1. Um nur die Karte von Deutschland anzuzeigen kann einfach /Karte/show/105 (250px) aufgerufen werden.
    - &lt;img src="{{URL::Asset('/karte/show/' . $demaps\[$x\]-&gt;loc\_id)}}" alt="Karte {{$demaps\[$x\]-&gt;GeodbMaster()-&gt;name()}}"&gt;
    - Bitte in eine for-schleife setzen oder das $x mit einer zahl ersetzen.
2. In der Funktion /Karte/showbig/105 (1090px) werden noch die Punkte hinzugezeichnet.
    - &lt;img src="{{URL::Asset('/karte/showbig/' . $demaps\[$x\]-&gt;loc\_id)}}" alt="Karte {{$demaps\[$x\]-&gt;GeodbMaster()-&gt;name()}}" usemap="#map-{{$demaps\[$x\]-&gt;loc\_id}}"&gt;
    - Bitte in eine for-schleife setzen oder das $x mit einer Zahl ersetzen.
3. In der Funktion /Karte/json/105 gebe ich noch die einzelnen Punkte als JSON zurück.
    - &lt;map name="map-{{$demaps\[$x\]-&gt;loc\_id}}" id="map-{{$demaps\[$x\]-&gt;loc\_id}}"&gt;

```
function gethtmlmap(id){
    $.ajax({
        url: "{{URL::asset("/karte/json")}}/" + id,
    }).done(function(data) {
        $("#map-" . id).html("");
        for(i=0; i < data.data.length; i++){
            area = $("#map-" + data.id).append("");
            $("#area" + data.data[i].x + data.data[i].y + data.data[i].r).mouseover(function (){
                UIkit.notify(data.data[$(this).data("id")].objects, {status:'info'});
            });
        }
    });
}

```

```
- Einfach als Javascript gethtmlmap($demaps[$x]->loc_id) aufrufen um an das JSON für die Karte zu kommen.
- UIkit.notify(....); setzt ein kleines notify am Kopf der Seite ab. (benötigt uikit)

```

### Daten abholen/Entfernung berechnen

[](#daten-abholenentfernung-berechnen)

Weg 1:

```
$geoloc = GeodbCoordinate::where("loc_id", $geotext->loc_id)->first();
$entrys = Location::select(\DB::raw("*, round(IFNULL((ACOS((SIN(RADIANS(" . $geoloc->lat ."))*SIN(RADIANS(lat))) + (COS(RADIANS(" . $geoloc->lat ."))*COS(RADIANS(lat))*COS(RADIANS(lon)-RADIANS(" . $geoloc->lon .")))) * 6371.110 ),0),2) AS distance"))->get();

```

Das Model Location hat die felder lat und lon gefüllt um nicht immer 100 MB an Daten zu durchsuchen.

Weg 2:

```
$augsburg = (new GeodbMaster())->searchByName("augsburg")->first();
$munich = (new GeodbMaster())->searchByPLZ(81929)->first();
$distanz = $augsburg->GeodbCoordinate()->calculatedistance($munich->GeodbCoordinate()->lon, $munich->GeodbCoordinate()->lat);

```

Sonstiges
---------

[](#sonstiges)

Um das ganze Skript in Aktion zu erleben besucht einfach [![Thermen-Portal](https://camo.githubusercontent.com/47dc85dcce5aeaf3fcef45ef17fb99d8c58a87ada1d213586fc88837d3d2196a/687474703a2f2f7777772e746865726d656e2d706f7274616c2e636f6d2f696d616765732f6e61766261726c6f676f2e706e67)](http://www.thermen-portal.com)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Total

2

Last Release

3522d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15785677?v=4)[Jörg Stemmer](/maintainers/thejoe8495)[@thejoe8495](https://github.com/thejoe8495)

---

Top Contributors

[![thejoe8495](https://avatars.githubusercontent.com/u/15785677?v=4)](https://github.com/thejoe8495 "thejoe8495 (17 commits)")[![amenk](https://avatars.githubusercontent.com/u/1087128?v=4)](https://github.com/amenk "amenk (1 commits)")

---

Tags

laravellaravel5opengeodb

### Embed Badge

![Health badge](/badges/equi-opengeodb-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/equi-opengeodb-laravel/health.svg)](https://phpackages.com/packages/equi-opengeodb-laravel)
```

###  Alternatives

[brexis/laravel-workflow

Integerate Symfony Workflow component into Laravel.

282126.8k](/packages/brexis-laravel-workflow)[summerblue/generator

Extend Laravel's generators scaffold.

33540.5k](/packages/summerblue-generator)[salmanzafar/laravel-geocode

A Laravel Library to find Lat and Long of a given Specific Address

154.3k](/packages/salmanzafar-laravel-geocode)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
