[Photon] Best way to import custom data into Photon ?
Christoph Lingg
christoph at lingg.eu
Wed Jul 15 08:31:06 UTC 2015
Salut Guillaume,
one possibility is to create a json-like file with a given structure, see example attached. You can import this file to elasticsearch directly with this command:
> curl -s -XPOST localhost:9200/photon/place/_bulk --data-binary @data.json; echo
see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html>
btw, I cannot recall if it was localhost:9200/photon/place/_bulk or localhost:9200/photon/_bulk You will find out yourself, let us know please.
And about the json structure, ask if you have question. Here is another example that has more features:
> {
> "osm_key": "amenity",
> "coordinate": {
> "lon": 10.16707863354695,
> "lat": 47.34246885
> },
> "street": {
> "de": "Walserstraße",
> "default": "Walserstraße"
> },
> "state": {
> "de": "Vorarlberg",
> "default": "Vorarlberg",
> "it": "Vorarlberg",
> "fr": "Vorarlberg",
> "en": "Vorarlberg"
> },
> "osm_type": "R",
> "housenumber": "264",
> "postcode": "6993",
> "osm_value": "townhall",
> "city": {
> "de": "Mittelberg",
> "default": "Mittelberg"
> },
> "country": {
> "default": "Österreich",
> "it": "Austria",
> "fr": "Autriche",
> "en": "Austria"
> },
> "importance": 0,
> "extent": {
> "type": "envelope",
> "coordinates": [
> [
> 10.1665299,
> 47.3427821
> ],
> [
> 10.167572,
> 47.3421556
> ]
> ]
> },
> "name": {
> "default": "Walserhaus"
> },
> "context": {},
> "osm_id": 1876856
> }
Pay attention to the importance field: it is a value between 0 and 1 and will (also) be used for ranking search matches. 0 = places of little importance (cafe), 1= super important (capital of a country).
Cheers,
Christoph
> Am 14.07.2015 um 13:04 schrieb Guillaume GAGNAIRE <contact at scrola.net>:
>
> Hi,
>
> For my projet, i have set up Photon on my dedicated server, that's awesome ! Btw, I have in my database a lot of custom POI ... How to import them into Photon, to being able to search in them ?
>
> Thanks by advance !
>
> This is, btw, an awesome work !
> _______________________________________________
> Photon mailing list
> Photon at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/photon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/photon/attachments/20150715/f06e0253/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample.json
Type: application/json
Size: 824 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/photon/attachments/20150715/f06e0253/attachment.json>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/photon/attachments/20150715/f06e0253/attachment-0001.html>
More information about the Photon
mailing list