Skip to content

Instantly share code, notes, and snippets.

@vladbatushkov
Created May 18, 2019 11:29
Show Gist options
  • Save vladbatushkov/d16f11a72f8a3ae1c13c3c0625f9e0b6 to your computer and use it in GitHub Desktop.
Save vladbatushkov/d16f11a72f8a3ae1c13c3c0625f9e0b6 to your computer and use it in GitHub Desktop.
Museums.
WITH "https://en.wikipedia.org" as url
CALL apoc.load.html(url + "/wiki/List_of_museums_in_Moscow", { data: "div.mw-content-ltr > div > ul a" }) YIELD value
UNWIND value.data as item
WITH { name: item.text, url: item.attributes.href } as m, url
CALL apoc.load.html(url + m.url, { data: "table.infobox.vcard span.geo" }) YIELD value
UNWIND value.data as coord
WITH apoc.text.split(coord.text, "; ") as coords, m
WITH { name: m.name, latitude: toFloat(coords[0]), longitude: toFloat(coords[1]) } as n
MERGE (:Museum { name: n.name, location: point({ latitude: n.latitude, longitude: n.longitude }) })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment