跳转到内容

模板:OSM Location map from table

维基百科,自由的百科全书

The map data supplied is now shown below in three sections:-

  1. The template to replace the {{OSM Location map}} in you article, with the routine to use table and mapfile data.
  2. The code to paste into a new .tab file in commons
  3. A matching set of code to paste into a .map file also in commons.

To set up an OSM Location map table

  • Step 1: Copy the whole of the .tab data page below into the clipboard.
  • Step 2: Create or edit the Wikimedia Commons file commons:Data:your filename here.tab (or another name of your choosing).
  • Step 3: Paste the data into the .tab page, (first delete any sample data that may be there). Add suitable content to description and sources fields. Preview and then SAVE.
  • Step 4: Copy the source code/template data of your {{OSM Location map}} into the 'discussion' page associated with your new .tab page on Wikimedia Commons. It would be painful to try re-creating your map marks from the .tab data. Re-using it in an altered form of map is only possible from the original and this is the most helpful place for it to be 'parked'.
  • Step 5: Replace your OSM Location map entry on your wikipedia page with the following, which sets up the map, and brings in the data from your new table. In the process you can safely delete the large slab of template parameters which you have saved on the .tab discussion page.
  • Step 6: Preview and save your wikipedia page with the slimmed-down map template in place.

Text for your wikipedia page:

{{OSM Location map from table
| lat = 0
| lon = 0
| zoom = 10
| width = 350
| height = 250
| data-table = your filename here.tab <!-- or other table name of your choosing -->
| mapfile = your filename here.map <!-- or other table name of your choosing -->
| title =  <!-- (optional) -->
| caption=  <!-- (optional) -->
}}


Text for pasting into the commons .tab page:

{
   "license": "CC0-1.0+",
   "description": {
       "en": ""
   },
   "sources": "source wikipedia page/ othersources. (Template:Graph:Street_map_with_marks data generated by wikipedia:template:OSM Location map from table)",
   "schema": {
       "fields": [
           {
               "name": "lat",
               "type": "number"
           },
           {
               "name": "lon",
               "type": "number"
           },
           {
               "name": "img",
               "type": "string"
           },
           {
               "name": "width",
               "type": "number"
           },
           {
               "name": "height",
               "type": "number"
           },
           {
               "name": "offsetX",
               "type": "number"
           },
           {
               "name": "offsetY",
               "type": "number"
           },
           {
               "name": "shape",
               "type": "string"
           },
           {
               "name": "color",
               "type": "string"
           },
           {
               "name": "strokeColor",
               "type": "string"
           },
           {
               "name": "size",
               "type": "number"
           },
           {
               "name": "text",
               "type": "localized"
           },
           {
               "name": "textAlign",
               "type": "string"
           },
           {
               "name": "textBaseline",
               "type": "string"
           },
           {
               "name": "textColor",
               "type": "string"
           },
           {
               "name": "textDx",
               "type": "number"
           },
           {
               "name": "textDy",
               "type": "number"
           },
           {
               "name": "textAngle",
               "type": "number"
           },
           {
               "name": "textRadius",
               "type": "number"
           },
           {
               "name": "textTheta",
               "type": "number"
           },
           {
               "name": "textFont",
               "type": "string"
           },
           {
               "name": "textFontSize",
               "type": "number"
           },
           {
               "name": "textFontWeight",
               "type": "string"
           },
           {
               "name": "textFontStyle",
               "type": "string"
           }
       ]
   },
   "data": [
[ 0, 0, "Mapscaleline.svg", 50, 8, 138, 115, null, null, null, null, { "en": "10 000km" }, "right", null, "grey", 22, -2, null, null, null, "Tahoma", 9, null, null ] ] }

.map file for use in Full Screen option

The same process can be used to create a commons .map file, using an identical process to the one above. (It is more often possible to re-use .map data than .tab, as it needs fewer customised items.) If you need to create or edit a .map file, you can do this at the Wikimedia Commons file commons:Data:your filename here.map (or another name of your choosing).

Text for pasting into the commons .map page:

{
   "license": "CC0-1.0+",
   "description": {
                   "en": "your description here" 
                  },
   "sources": "** source wikipedia page/ othersources. (GeoJSON data generated by wikipedia:template:OSM Location map from table)",
   "zoom": 11,
   "latitude": 52,
   "longitude": 0,
   "data":  
{"type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "marker-color": "#B80000", "marker-size": "small", "marker-symbol": "", "title": { "en": "" }, "description": { "en": "" } }, "geometry": {"type": "Point", "coordinates": [0,0] } } ] } }

|}