All Projects → komoot → Photon

komoot / Photon

an open source geocoder for openstreetmap data

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Photon

Mimirsbrunn
Geocoding and reverse-geocoding (with OSM data)
Stars: ✭ 165 (-85.98%)
Mutual labels:  elasticsearch, geocoding, geocoder, openstreetmap
Geo Golang
Go library to access geocoding and reverse geocoding APIs
Stars: ✭ 394 (-66.53%)
Mutual labels:  geocoding, geocoder, openstreetmap
Mapboxgeocoder.swift
Address search and reverse geocoding in Swift or Objective-C on iOS, macOS, tvOS, and watchOS
Stars: ✭ 115 (-90.23%)
Mutual labels:  search, geocoding, geocoder
Osmunda
An offline geocode library for android, powered by SQLite, using osm data. 离线地理编码Android库,基于SQLite,使用开放街道地图数据。
Stars: ✭ 37 (-96.86%)
Mutual labels:  geocoding, openstreetmap, geocoder
Pelias Android Sdk
Android sdk for pelias
Stars: ✭ 20 (-98.3%)
Mutual labels:  search, geocoding, geocoder
NominatimGeocoderBackend
UnifiedNlp geocoder backend that uses the OSM Nominatim service
Stars: ✭ 49 (-95.84%)
Mutual labels:  geocoding, openstreetmap, geocoder
Searchkit
GraphQL API & React UI components for Elasticsearch. The easiest way to build a great search experience
Stars: ✭ 4,338 (+268.56%)
Mutual labels:  search, elasticsearch
Reactivesearch
Search UI components for React and Vue: powered by appbase.io / Elasticsearch
Stars: ✭ 4,531 (+284.96%)
Mutual labels:  search, elasticsearch
Elasticsuite
Smile ElasticSuite - Magento 2 merchandising and search engine built on ElasticSearch
Stars: ✭ 647 (-45.03%)
Mutual labels:  search, elasticsearch
Foselasticabundle
Elasticsearch PHP integration for your Symfony project using Elastica.
Stars: ✭ 1,142 (-2.97%)
Mutual labels:  search, elasticsearch
Googleapi
C# .NET Core Google Api (Maps, Places, Roads, Search, Translate). Supports all endpoints and requests / responses.
Stars: ✭ 346 (-70.6%)
Mutual labels:  search, geocoding
Elasticsql
convert sql to elasticsearch DSL in golang(go)
Stars: ✭ 687 (-41.63%)
Mutual labels:  search, elasticsearch
Geocoder
🌎 GoLang package that provides an easy way to use the Google Geocoding API
Stars: ✭ 23 (-98.05%)
Mutual labels:  geocoding, geocoder
Awesome Elasticsearch
A curated list of the most important and useful resources about elasticsearch: articles, videos, blogs, tips and tricks, use cases. All about Elasticsearch!
Stars: ✭ 4,168 (+254.12%)
Mutual labels:  search, elasticsearch
Fess
Fess is very powerful and easily deployable Enterprise Search Server.
Stars: ✭ 561 (-52.34%)
Mutual labels:  search, elasticsearch
Xapiand
Xapiand: A RESTful Search Engine
Stars: ✭ 347 (-70.52%)
Mutual labels:  search, elasticsearch
Odsc 2020 nlp
Repository for ODSC talk related to Deep Learning NLP
Stars: ✭ 20 (-98.3%)
Mutual labels:  search, elasticsearch
Flexsearch
Next-Generation full text search library for Browser and Node.js
Stars: ✭ 8,108 (+588.87%)
Mutual labels:  search, elasticsearch
Rom Elasticsearch
Elasticsearch adapter for rom-rb
Stars: ✭ 30 (-97.45%)
Mutual labels:  search, elasticsearch
Nominatim Docker
Fully-featured container for geocoding, reverse geocoding and address lookup based on Nominatim and Open Street Map data.
Stars: ✭ 52 (-95.58%)
Mutual labels:  geocoding, openstreetmap

photon

Continuous Integration

photon is an open source geocoder built for OpenStreetMap data. It is based on elasticsearch - an efficient, powerful and highly scalable search platform.

photon was started by komoot and provides search-as-you-type and multilingual support. It's used in production with thousands of requests per minute at www.komoot.de. Find our public API and demo on photon.komoot.io. Until October 2020 the API was available under photon.komoot.de. Requests still work as they redirected but please update your apps accordingly.

Contribution

All code contributions and bug reports are welcome!

For questions please send an email to our mailing list.

Feel free to test and participate!

Licence

photon software is open source and licensed under Apache License, Version 2.0

Features

  • high performance
  • highly scalability
  • search-as-you-type
  • multilingual search
  • location bias
  • typo tolerance
  • filter by osm tag and value
  • filter by bounding box
  • reverse geocode a coordinate to an address
  • OSM data import (built upon Nominatim) inclusive continuous updates

Installation

photon requires java, at least version 8.

Download the search index (53G gb compressed, worldwide coverage, languages: English, German, French and local name). The search index is updated weekly and thankfully provided by GraphHopper with the support of lonvia.

Make sure you have bzip2 or pbzip2 installed and execute one of these two commands in your shell. This will download, uncompress and extract the huge database in one step:

wget -O - https://download1.graphhopper.com/public/photon-db-latest.tar.bz2 | bzip2 -cd | tar x
# you can significantly speed up extracting using pbzip2 (recommended):
wget -O - https://download1.graphhopper.com/public/photon-db-latest.tar.bz2 | pbzip2 -cd | tar x

Now get the latest version of photon from the releases and start it:

java -jar photon-*.jar

Use the -data-dir option to point to the parent directory of photon_data if that directory is not in the default location ./photon_data. Before you can send requests to photon, ElasticSearch needs to load some data into memory so be patient for a few seconds.

Check the URL http://localhost:2322/api?q=berlin to see if photon is running without problems. You may want to use our leaflet plugin to see the results on a map.

To enable CORS (cross-site requests), use -cors-any to allow any origin or -cors-origin with a specific origin as the argument. By default, CORS support is disabled.

Discover more of photon's feature with its usage java -jar photon-*.jar -h.

Building

photon uses maven for building. To build the package from source make sure you have a JDK and maven installed. Then run:

mvn package

Customized Search Data

If you need search data in other languages or restricted to a country you will need to create your search data by your own. Once you have your Nominatim database ready, you can import the data to photon.

If you haven't already set a password for your nominatim database user, do it now (change user name and password as you like, below):

su postgres
psql
ALTER USER nominatim WITH ENCRYPTED PASSWORD 'mysecretpassword';

Import the data to photon:

java -jar photon-*.jar -nominatim-import -host localhost -port 5432 -database nominatim -user nominatim -password mysecretpassword -languages es,fr

The import of worldwide data set will take some hours/days, SSD/NVME disks are recommended to accelerate nominatim queries.

Updating from OSM via Nominatim

In order to update nominatim from OSM and then photon from nominatim, you must start photon with the nominatim database credentials on the command line:

java -jar photon-*.jar -host localhost -port 5432 -database nominatim -user nominatim -password ...

A nominatim setup is also a requirement to have continuous updates. To keep nominatim in sync with the latest OSM changes and to update photon with nominatim afterwards run:

export NOMINATIM_DIR=/home/nominatim/...
./continuously_update_from_nominatim.sh

If you have updated nominatim with another method, photon can be updated by making a HTTP GET request to /nominatim-update, e.g. with this command:

curl http://localhost:2322/nominatim-update

Search API

Search

http://localhost:2322/api?q=berlin

Search with Location Bias

http://localhost:2322/api?q=berlin&lon=10&lat=52

Increase this bias (range is 0.1 to 10, default is 1.6)

http://localhost:2322/api?q=berlin&lon=10&lat=52&location_bias_scale=2

Reverse geocode a coordinate

http://localhost:2322/reverse?lon=10&lat=52

Adapt Number of Results

http://localhost:2322/api?q=berlin&limit=2

Adjust Language

http://localhost:2322/api?q=berlin&lang=it

Filter results by bounding box

Expected format is minLon,minLat,maxLon,maxLat.

http://localhost:2322/api?q=berlin&bbox=9.5,51.5,11.5,53.5

Filter results by tags and values

Note: the filter only works on principal OSM tags and not all OSM tag/value combinations can be searched. The actual list depends on the import style used for the Nominatim database (e.g. settings/import-full.style). All tag/value combinations with a property 'main' are included in the photon database. If one or many query parameters named osm_tag are present, photon will attempt to filter results by those tags. In general, here is the expected format (syntax) for the value of osm_tag request parameters.

  1. Include places with tag: osm_tag=key:value
  2. Exclude places with tag: osm_tag=!key:value
  3. Include places with tag key: osm_tag=key
  4. Include places with tag value: osm_tag=:value
  5. Exclude places with tag key: osm_tag=!key
  6. Exclude places with tag value: osm_tag=:!value

For example, to search for all places named berlin with tag of tourism=museum, one should construct url as follows:

http://localhost:2322/api?q=berlin&osm_tag=tourism:museum

Or, just by they key

http://localhost:2322/api?q=berlin&osm_tag=tourism

Results as GeoJSON

{
  "features": [
    {
      "properties": {
        "name": "Berlin",
        "state": "Berlin",
        "country": "Germany",
        "countrycode": "DE",
        "osm_key": "place",
        "osm_value": "city",
        "osm_type": "N",
        "osm_id": 240109189
      },
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          13.3888599,
          52.5170365
        ]
      }
    },
    {
      "properties": {
        "name": "Berlin Olympic Stadium",
        "street": "Olympischer Platz",
        "housenumber": "3",
        "postcode": "14053",
        "state": "Berlin",
        "country": "Germany",
        "countrycode": "DE",
        "osm_key": "leisure",
        "osm_value": "stadium",
        "osm_type": "W",
        "osm_id": 38862723,
        "extent": [
          13.23727,
          52.5157151,
          13.241757,
          52.5135972
        ]
      },
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          13.239514674078611,
          52.51467945
        ]
      }
    }]
  }

Related Projects

  • photon's search configuration was developed with a specific test framework. It is written in Python and hosted separately.
  • R package to access photon's public API with R
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].