{"id":15659044,"url":"https://github.com/edsu/wikigeo","last_synced_at":"2025-05-05T17:10:31.791Z","repository":{"id":8390859,"uuid":"9967512","full_name":"edsu/wikigeo","owner":"edsu","description":"JavaScript library for getting geojson from the Wikipedia API","archived":false,"fork":false,"pushed_at":"2015-09-25T14:36:28.000Z","size":1846,"stargazers_count":22,"open_issues_count":2,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-30T22:32:24.614Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://edsu.github.io/wikigeo","language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edsu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-09T20:13:49.000Z","updated_at":"2021-04-16T19:06:54.000Z","dependencies_parsed_at":"2022-09-01T16:22:20.441Z","dependency_job_id":null,"html_url":"https://github.com/edsu/wikigeo","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edsu%2Fwikigeo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edsu%2Fwikigeo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edsu%2Fwikigeo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edsu%2Fwikigeo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edsu","download_url":"https://codeload.github.com/edsu/wikigeo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252542066,"owners_count":21764907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T13:14:45.000Z","updated_at":"2025-05-05T17:10:31.749Z","avatar_url":"https://github.com/edsu.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"wikigeo\n=======\n\n[![Build Status](https://travis-ci.org/edsu/wikigeo.svg)](http://travis-ci.org/edsu/wikigeo)\n\nwikigeo allows you to fetch [geojson](http://www.geojson.org/geojson-spec.html)\nfor [Wikipedia](http://wikipedia.org) articles around a given geographic\ncoordinate. It can be easily added to a map using [Leaflet's geojson\nsupport](http://leafletjs.com/examples/geojson.html). The data comes directly\nfrom the [Wikipedia API](http://en.wikipedia.org/w/api.php) which has the\n[GeoData](http://www.mediawiki.org/wiki/Extension:GeoData) extension installed.\n\n![Leaflet Screenshot](http://edsu.github.io/wikigeo/img/screenshot.png)\n\nBasics\n------\n\nWhen you add wikigeo.js to your HTML page you will get a function called \n`geojson` which you pass a coordinate `[longitude, latitude]` and a callback\nfunction that will receive the geojson data:\n\n```javascript\ngeojson([-73.94, 40.67], function(data) {\n  console.log(data);\n});\n```\n\nThe geojson for this call should look something like:\n\n```javascript\n{\n  \"type\": \"FeatureCollection\",\n  \"features\": [\n    {\n      \"id\": \"30854694\",\n      \"type\": \"Feature\",\n      \"properties\": {\n        \"url\": \"https://en.wikipedia.org/?curid=30854694\",\n        \"name\": \"Jewish Children\\'s Museum\",\n        \"touched\": \"2014-05-18T12:50:57Z\"\n    },\n      \"geometry\": {\n        \"type\": \"Point\",\n        \"coordinates\": [\n          -73.9419,\n          40.6689\n        ]\n      }\n    },\n    {\n      \"id\": \"729460\",\n      \"type\": \"Feature\",\n      \"properties\": {\n        \"url\": \"https://en.wikipedia.org/?curid=729460\",\n        \"name\": \"Kingston Avenue (IRT Eastern Parkway Line)\",\n        \"touched\": \"2014-05-13T00:12:17Z\"\n      },\n      \"geometry\": {\n        \"type\": \"Point\",\n        \"coordinates\": [\n          -73.9422,\n          40.6694\n        ]\n      }\n    }\n  ]\n}\n```\n\nIf you want to get more than 10 results, or increase the radius use the \n`limit` and `radius` options:\n\n```javascript\ngeojson([-73.94, 40.67], {radius: 10000, limit: 100}, function(data) {\n  console.log(data);\n});\n```\n\nAdditional Wikipedia Properties\n-------------------------------\n\nAdditional properties of the Wikipedia articles can be added to the\ngeojson feature properties by setting any of the following options to true: \n`images`, `categories`, `summaries`,  `templates`.  For example:\n\n```javascript\ngeojson(\n  [-73.94, 40.67], \n  {\n    limit: 5,\n    radius: 1000,\n    images: true, \n    categories: true, \n    summaries: true,\n    templates: true\n  }, \n  function(data) {\n    console.log(data);\n  }\n);\n```\n\nBeware, this can increase your query time since multiple trips to the Wikipedia\nAPI are often required. Here's what the results would look like for the above\ncall:\n\n```javascript\n\n{\n  \"type\": \"FeatureCollection\",\n  \"features\": [\n     {\n      \"id\": \"43485\",\n      \"type\": \"Feature\",\n      \"properties\": {\n        \"url\": \"https://en.wikipedia.org/?curid=43485\",\n        \"name\": \"Silver Spring, Maryland\",\n        \"touched\": \"2014-05-20T04:25:48Z\",\n        \"image\": \"Silver_Spring_Montage.jpg\",\n        \"imageUrl\": \"https://upload.wikimedia.org/wikipedia/commons/4/48/Silver_Spring_Montage.jpg\",\n        \"templates\": [\"!\",\n          \"-\",\n          \"Abbr\",\n          \"Ambox\",\n          \"Both\",\n          \"Br separated entries\",\n          \"Category handler\",\n          \"Citation\",\n          \"Citation needed\",\n          \"Cite news\",\n          \"Cite web\",\n          \"Column-width\",\n          \"Commons\",\n          \"Commons category\",\n          \"Convert\",\n          \"Coord\",\n          \"Country data Maryland\",\n          \"Country data United States\",\n          \"Country data United States of America\",\n          \"DCMetroArea\",\n          \"Dead link\",\n          \"Expand section\",\n          \"Fix\",\n          \"Fix/category\",\n          \"Flag\",\n          \"Flag/core\",\n          \"Flagicon image\",\n          \"GR\",\n          \"Geobox coor\",\n          \"Geographic reference\",\n          \"Infobox\",\n          \"Infobox settlement\",\n          \"Infobox settlement/areadisp\",\n          \"Infobox settlement/densdisp\",\n          \"Infobox settlement/impus\",\n          \"Infobox settlement/lengthdisp\",\n          \"Infobox settlement/pref\",\n          \"Largest cities\",\n          \"Largest cities of Maryland\",\n          \"Maryland\",\n          \"Max\",\n          \"Max/2\",\n          \"Montgomery County, Maryland\",\n          \"Navbar\",\n          \"Navbox\",\n          \"Navbox subgroup\",\n          \"Navboxes\",\n          \"Nowrap\",\n          \"Order of magnitude\",\n          \"Precision\",\n          \"Reflist\",\n          \"Rnd\",\n          \"Side box\",\n          \"Sister\",\n          \"Talk other\",\n          \"Transclude\",\n          \"US Census population\",\n          \"US county navigation box\",\n          \"US state navigation box\",\n          \"Unbulleted list\",\n          \"Wikivoyage\",\n          \"National Register of Historic Places in Maryland\",\n          \"Navbar\",\n          \"Navbox\",\n          \"Reflist\",\n          \"Str left\",\n          \"Talk other\",\n          \"Transclude\",\n          \"Arguments\",\n          \"Citation/CS1\",\n          \"Citation/CS1/Configuration\",\n          \"Citation/CS1/Date validation\",\n          \"Citation/CS1/Whitelist\",\n          \"Coordinates\",\n          \"HtmlBuilder\",\n          \"Infobox\",\n          \"Location map\",\n          \"Math\",\n          \"Navbar\",\n          \"Navbox\",\n          \"Yesno\"\n        ],\n        \"summary\": \"The Polychrome Historic District is a national historic district in the Four Corners neighborhood in Silver Spring, Montgomery County, Maryland. It recognizes a group of five houses built by John Joseph Earley in 1934 and 1935. Earley used precast concrete panels with brightly colored aggregate to produce the polychrome effect, with Art Deco details. The two-inch-thick panels were attached to a conventional wood frame. Earley was interested in the use of mass-production techniques to produce small, inexpensive houses, paralleling Frank Lloyd Wright\\'s Usonian house concepts.\",\n        \"categories\": [\"Art Deco architecture in Maryland\",\n          \"Coordinates on Wikidata\",\n          \"Historic American Buildings Survey in Maryland\",\n          \"Historic districts in Maryland\",\n          \"Houses in Montgomery County, Maryland\",\n          \"Houses on the National Register of Historic Places in Maryland\",\n          \"Maryland Registered Historic Place stubs\"\n        ]\n      },\n      \"geometry\": {\n        \"type\": \"Point\",\n        \"coordinates\": [\n          -77.0158,\n          39.0181\n        ]\n      }\n    }\n  ]\n}\n```\n\nQuick Start With Leaflet\n------------------------\n\nIn your HTML, you'll want to use Leaflet as usual:\n\n```javascript\n\n// create the map\n\nvar map = L.map('map').setView([40.67, -73.94], 13);\nvar osmLayer = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {});\nosmLayer.addTo(map);\n\n// get geojson and add it to the map\n\ngeojson([-73.94, 40.67], {radius: 10000, limit: 50}, function(data) {\n    L.geoJson(data).addTo(map)\n});\n```\n\nPlease note that the order of geo coordinates in Leaflet is (lat, lon) whereas\nin geojson it is (lon, lat). \n\nThat's it, to get the basic functionality working. Open example.html for a\nworking example.\n\nDevelop\n-------\n\nIf you want to hack on wikigeo you'll need [Node](http://nodejs.org) and\nthen you'll need to install some dependencies for testing:\n\n    npm install\n\nThis will install mocha, which you can use to run the tests, simply do:\n\n    npm test\n\nand you should see something like a nyan cat:\n\n```\n  \u003e wikigeo@1.0.0 test /home/despairblue/vcs/git/wikigeo\n  \u003e mocha --colors --reporter nyan --compilers coffee:coffee-script/register test/wikigeo.coffee\n\n   11  -_-_-_-_-_-__,------,\n   0   -_-_-_-_-_-__|  /\\_/\\ \n   0   -_-_-_-_-_-_~|_( ^ .^) \n       -_-_-_-_-_-_ \"\"  \"\" \n\n    11 passing (5s)\n```\n\nLicense\n-------\n\n[![cc0](http://i.creativecommons.org/p/zero/1.0/88x31.png)](http://creativecommons.org/publicdomain/zero/1.0/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedsu%2Fwikigeo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedsu%2Fwikigeo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedsu%2Fwikigeo/lists"}