User:Arjunaraoc/Adding Geojson maps on Wikipedia

While Kartotherian extention helps in displaying features of OSM such as points, lines, and shapes, there is a need to show OSM data that is not rendered by default style sheet such as religious places or a irrigation project which includes nested relations. Geojson data file can be used to show the desired combination of features exported from OSM. The data file is added on Commons. The defaulting rendering shows only the outlines in black colour when using the data file. To change the color as appopriate for the nature of feature, it is required to edit the data file to add properties such as "stroke", "stroke-width".

Text editors such as Bluefish can be used to look for geometry pattern to add the styling properties

Replace

},               "geometry": { with ,                   "stroke": "#4166fc", "stroke-width": 5, "stroke-opacity": 1 },               "geometry": { can help in changing the colour. Please note to copy the strings from the source wikitext mode to capture the carriage return and tab characters.

If the number of features is limited [https:geojson.io geojson tool by Mapbox] can also be used. Advanced tools like mapshaper or a general purpose GIS tool like QGIS could be helpful to preprocess the data if required.

Even after adding styling properties, the page incorporating the said map may take a day to reflect the changed propeties.

An example file incorporating the above edits is c:Data:Andhra Pradesh/Gundlakamma River.map

Using overpass-turbo
Overpass script such as the following one for Gundlakamma river relation can be used to get the map data and export it as geojson. [out:json]; relation(17320339);>;out;

If a relation is complex and some features are missing in the output, specific relations or ways for those could be added to the script to get the complete map data.

Annotating map data
The map data can be further annotated by using Kartotherian extension feature. An example is given below.

 [ { "type": "ExternalData", "service": "page", "title": "Gundlakamma_River.map" }, { "type": "ExternalData", "service": "geopoint", "ids": "Q5315911", "properties": { "title":"Dupadu", "marker-symbol": "-number", "marker-color": "302060" } }, { "type": "ExternalData", "service": "geopoint", "ids": "Q22330090", "properties": { "title":"Chandavaram Buddhist site", "marker-symbol": "-number", "marker-color": "302060" } }, { "type": "ExternalData", "service": "geopoint", "ids": "Q18170998", "properties": { "title":"Kanuparti", "marker-symbol": "-number", "marker-color": "302060" } }, { "type": "ExternalData", "service": "geopoint", "ids": "Q13007117", "properties": { "title":"Motupalli", "marker-symbol": "-number", "marker-color": "302060" } } ]