Help:Extension:Kartographer/pt-br

A extensão permite que você crie mapas interativos e estáticos nas páginas wiki da Wikimedia. This page is an exhaustive reference for using Kartographer, including the many options available when using the tags, which embeds maps directly in wiki pages, and , which creates links to full-page interactive maps, and touches on the elements of GeoJSON supported by Kartographer. Você encontrará uma riqueza de exemplos na parte inferior da página.

Para um início rápido menos técnico, confira. Para obter ajuda com o Kartographer no Editor Visual, confira. Para ajuda com Kartographer e OpenStreetMaps, confira.

Sintaxe básica do mapa
To place a map or a map link directly on a wiki page, Kartographer offers two tags:, which embeds a map inline that links to a full-screen interactive map, and , which creates rich text (with an optional marker) that links to a full-screen interactive map.

Algumas wikis envolvem essas tags em predefinições, como Mapbox e Mapframe. Consulte a página de ajuda do Kartographer em sua wiki local para ver se ela possui predefinições — ou use as tags diretamente com este documento como seu guia.



A tag incorpora um mapa em uma página wiki. A tag deve estar vazia ou conter GeoJSON. Veja abaixo mais recursos sobre como escrever GeoJSON.

A tag cria um link para um mapa em tela cheia.

* = required

Self-closing tags
When not using GeoJSON, you can use and  as self-closing, standalone tags.

Self-closing:

Enclosing GeoJSON:

GeoJSON
 { "type": "FeatureCollection", "features": [ {     "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.41816520690917,         37.79097260220947        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.40786552429199,         37.799654055191525        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.40185737609865,         37.796262984039544        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.38743782043457,         37.80535070427755        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.38005638122557,         37.795449103799726        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.40941047668457,         37.81850557172186        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.40357398986815,         37.81280993744834        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.39842414855956,         37.8071138637568        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.41181373596191,         37.78595317184089        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.39542007446289,         37.787674400057654        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.38649368286131,         37.78401144262929        ]      }    }  ] }

The and  tags can either be empty or contain valid GeoJSON, to annotate the map with markers, draw shapes, and apply a mask area.

For more detail on this broad topic, you can read this helpful introduction to GeoJSON as well as the full GeoJSON specification.

Marcadores
Os mapas que usam GeoJSON podem conter um ou mais marcadores para indicar locais especiais. These markers are set using marker-specific keywords under the "properties" level in GeoJSON.

O Kartographer suporta a especificação simplestyle com ícones Maki, que estão disponíveis sob CC0 license. Veja a lista completa de ícones suportados.

Resultado:

Auto-counters
Vários marcadores em um mapa podem ser agrupados e nomeados usando padrões e contadores. Below is a summary of styling attributes for items placed on a map using GeoJSON. For more information, see the simplestyle spec.

For a rich variety of examples, see the Examples section.

Shapes
GeoJSON allows you to add lines and geometric areas as annotations to your map. You can define simple inline shapes or import them from external databases.

Inline
GeoJSON allows you to draw points (markers), simple lines and geometric areas as part of your map definition. The following examples include the "geometry" attribute of GeoJSON objects inside a object. Consult the full GeoJSON specification for more information.

Dados externos
 { "type": "ExternalData", "service": "geoshape", "ids": "Q797" }

GeoJSON permite obter contornos de objetos geográficos de fontes externas usando o atributo "type" com o valor "ExternalData".

Os mapas podem ser extraídos de objetos geográficos conhecidos no banco de dados OpenStreetMap usando seu ID Wikidata; eles também podem vir de consultas do Wikidata SPARQL ou de formas no Wikimedia Commons (arquivo .map).

Além disso, os mapas podem ser vinculados diretamente ao GeoJSON bruto armazenado no Wikimedia Commons: veja para detalhes.

Objects can be rendered using shape data from an external source in three different ways:


 * - Desenha uma linha simples.
 * - Desenha um polígono com um interior sombreado.
 * - Desenha um polígono e sombreia tudo fora do polígono.

Shapes via Wikidata ID
 { "type": "ExternalData", "service": "geoshape", "ids": "Q34713,Q701153" }

Os IDs do Wikidata são relativamente novos para a comunidade OSM. No início de 2022, existem aproximadamente 1,9 milhão de elementos com IDs do Wikidata. You can add your own at https://www.openstreetmap.org/ -- be sure to add the  tag and the corresponding   value. Os dados normalmente ficam disponíveis para o Kartographer em dois dias. Saiba mais na wiki do OSM.

Shapes via Wikidata query
 { "type": "ExternalData", "service": "geoshape", "query": "SELECT ?id ?head (SAMPLE(?img) as ?img_) (min(?partyId) as ?party) (if(?party = '0', '#800000', if(?party = '1', '#000080', '#008000')) as ?fill) (concat(, ?headLabel, ) as ?title) (concat(?stateLabel, '\\n', '') as ?description) WHERE { ?id wdt:P31 wd:Q35657 . ?id wdt:P6 ?head . ?head wdt:P102 ?party . BIND(if(?party = wd:Q29468, '0', if(?party = wd:Q29552, '1', '2')) as ?partyId) SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' . ?head rdfs:label ?headLabel . ?id rdfs:label ?stateLabel . } OPTIONAL { ?head wdt:P18 ?img . } ?link schema:about ?head . ?link schema:isPartOf  .} GROUP BY ?id ?head ?headLabel ?link ?stateLabel" } Instead of a Wikidata Item ID, a map can also derive geoshapes from a Wikidata query in SPARQL. (You can create SPARQL queries using the Query Builder.)

Para obter instruções detalhadas, consulte.

Dados de mapas do Commons
 { "type": "ExternalData", "service": "page", "title": "Neighbourhoods/New York City.map" } Dados de mapa armazenados no Commons podem ser desenhados no mapa. Por exemplo, c:Data:Neighbourhoods/New York City.map:


 * Informações adicionais: 

Mask layer
 { "type": "ExternalData", "service": "geomask", "ids": "Q34713", "properties": { "fill": "#555555", "fill-opacity": 0.5, "stroke": "#000000", "stroke-width": 1, "stroke-opacity": 1 } }

A mask is just an inside-out shape, specified in the same way but with the exterior of the shape shaded.

Combining multiple data types
You can combine ExternalData, Feature, and FeatureCollection objects together in the same or  element, for example to highlight features with titles and descriptions on top of externally sourced objects.

Map data from Commons can be combined with other types of data by grouping them in parallel blocks of GeoJSON. See #Mixed types for various combinations.

Styling shapes
 { "type": "ExternalData", "service": "geoline", "ids": "Q2108", "properties": { "title": "Highway I-696", "description": "", "stroke": "#ffb100", "stroke-width": 8 } }

In addition to the marker styling above, lines and areas support these simplestyle properties:

Overlapping elements
Map elements that overlap are drawn in the order they appear in the code. If a map includes two lines that overlap, the line defined first will appear beneath the line defined next. This applies to any elements defined in the code that draw on the map.

Examples
 { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {"fill": "#ff0000","fill-opacity": 0.7,"stroke-width": 0}, "geometry": { "type": "Polygon", "coordinates": [ [ [ 77.926025390625, -25.150257104114733 ], [ 80.14251708984374, -25.150257104114733 ], [ 80.14251708984374, -24.43714786161562 ], [ 77.926025390625, -24.43714786161562 ], [ 77.926025390625, -25.150257104114733 ] ] ] } }, { "type": "Feature", "properties": {"stroke": "#fffa00","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -25.150257104114733 ], [ 80.14251708984374, -24.43714786161562 ] ] } }, { "type": "Feature", "properties": {"stroke": "#000000","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -24.43714786161562 ], [ 80.14251708984374, -25.150257104114733 ] ] } } ] }

The code for the map above includes three elements, all of which use GeoJSON's "feature" functionality. The first feature is a "Polygon" - the red rectangle. This is followed by two "LineString" features. The yellow line is defined first, so it appears beneath the black line. Note that the hierarchy used to draw elements applies regardless of whether the data is raw GeoJSON or comes from a Wikidata ID or Commons data page.

The map below changes the order from that of the first example: the black line is defined first and is thus moved to the bottom of the stack:

 { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {"stroke": "#000000","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -24.43714786161562 ], [ 80.14251708984374, -25.150257104114733 ] ] } }, { "type": "Feature", "properties": {"fill": "#ff0000","fill-opacity": 0.7,"stroke-width": 0}, "geometry": { "type": "Polygon", "coordinates": [ [ [  77.926025390625,  -25.150257104114733  ],  [  80.14251708984374,  -25.150257104114733  ],  [  80.14251708984374,  -24.43714786161562  ],  [  77.926025390625,  -24.43714786161562  ],  [  77.926025390625,  -25.150257104114733  ]  ]  ]  } }, { "type": "Feature", "properties": {"stroke": "#fffa00","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -25.150257104114733 ], [ 80.14251708984374, -24.43714786161562 ] ] } } ] }

Reference

 * Full GeoJSON specification (RFC7946)
 * GeoJSON on English Wikipedia
 * simplestyle spec used by Kartographer
 * Maki icon set used by Kartographer

Guides

 * HERE.com's intro to GeoJSON
 * A guide to the GeoJSON.io editor

Editors and tools

 * GeoJSON.io editor
 * Vector.rocks editor
 * GeoJSON linter to validate your GeoJSON

Grupos
Para uso no projeto Wikivoyage, é necessária a exibição de um mapa com seus dados definidos em algum lugar da página. Por exemplo, podem haver múltiplos pontos de interesse definidos com a marcação $maplink, e um mapa no lado da página, exibindo-os. There may be multiple points of interest (POI) defined with tags, all of which appear on a single common map on the side of the page. (See an example using the city of Salzburg.)

O conceito de agrupamento permite que editores compartilhem dados entre várias marcações $mapframe e $maplink.

Por padrão, os dados das marcações $mapframe e $maplink são exibidos apenas nelas e nenhum outro lugar.

Se $mapframe ou $maplink especificarem o atributo $group, os dados destas serão alocados num grupo nomeado, juntos com os outros dados pelo mesmo grupo. Como resultado, quaisquer marcações com o mesmo nome do grupo exibirão os mesmos dados de mapeamento, e cada uma poderá adicionar dados ao grupo.

Each tag on a Wikivoyage tag displays an embedded map displaying the groups specified in its tag.

Uma marcação, já pertencendo ou não a um grupo, poderá também exibir outros grupos especificando o atributo. Nomes de grupo separados por vírgulas poderão ser especificados. O nome do grupo apenas pode conter letras minúsculas disponíveis na língua inglesa. Essa matriz mostra quais dados serão exibidos para cada marcação.

Example:

Idiomas e substitutos
Os mapas do Kartographer obtêm seus rótulos do projeto de mapeamento de código-aberto OpenStreetMap (https://www.openstreetmap.org/). Por padrão, o Kartographer tenta exibir rótulos no idioma da wiki no qual o mapa incorporado é exibido. Se esse idioma não estiver disponível, o mapa usará o idioma substituto configurado na wiki e, em seguida, o idioma local na região especificada no mapa. Se nenhum deles estiver disponível, o Kartographer não exibirá nenhum rótulo.

You can specify the language to use for labels with the  attribute and by setting its value to the desired language code Example:   will display labels in Japanese, if available.

Para usar o idioma local para a área do mapa, especifique. Para mais informações sobre como usar o idioma local em seus rótulos e sobre dados multilíngues do OpenStreetMap em geral, leia este post. Kartographer maps get their data, including map label data in all available languages, from the open-source mapping project OpenStreetMap. If the map you want to display doesn't offer labels in the desired language, you can always add labels in that language by adding them yourself to OpenStreetMap. Note that country and city names are drawn from label nodes in OpenStreetMap, not from the data attached to boundary relations. To get started, see the OpenStreetMap Beginners’ Guide and these best practices in naming conventions.

Simples
 { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-122.3988, 37.8013] }, "properties": { "title": "Exploratorium", "description": "", "marker-symbol": "museum", "marker-size": "large", "marker-color": "0050d0" } }

Groups of automatic counters
 { "type": "FeatureCollection", "features": [ {     "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.41816520690917,         37.79097260220947        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.40786552429199,         37.799654055191525        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.40185737609865,         37.796262984039544        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.38743782043457,         37.80535070427755        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number", "marker-color": "302060" },     "geometry": { "type": "Point", "coordinates": [ -122.38005638122557,         37.795449103799726        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.40941047668457,         37.81850557172186        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.40357398986815,         37.81280993744834        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-letter", "marker-color": "208020" },     "geometry": { "type": "Point", "coordinates": [ -122.39842414855956,         37.8071138637568        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.41181373596191,         37.78595317184089        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.39542007446289,         37.787674400057654        ]      }    },    {      "type": "Feature", "properties": { "marker-symbol": "-number-bar", "marker-color": "f01080" },     "geometry": { "type": "Point", "coordinates": [ -122.38649368286131,         37.78401144262929        ]      }    }  ] }

Wikidata query
 { "type": "ExternalData", "service": "geoshape", "query": "SELECT ?id ?head (SAMPLE(?img) as ?img_) (min(?partyId) as ?party) (if(?party = '0', '#800000', if(?party = '1', '#000080', '#008000')) as ?fill) (concat(, ?headLabel, ) as ?title) (concat(?stateLabel, '\\n', '') as ?description) WHERE { ?id wdt:P31 wd:Q35657 . ?id wdt:P6 ?head . ?head wdt:P102 ?party . BIND(if(?party = wd:Q29468, '0', if(?party = wd:Q29552, '1', '2')) as ?partyId) SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' . ?head rdfs:label ?headLabel . ?id rdfs:label ?stateLabel . } OPTIONAL { ?head wdt:P18 ?img . } ?link schema:about ?head . ?link schema:isPartOf  .} GROUP BY ?id ?head ?headLabel ?link ?stateLabel" }

Map data from Commons
 { "type": "ExternalData", "service": "page", "title": "Neighbourhoods/New York City.map" }

Mixed types
<mapframe text="Caderousse city wall" width="300" height="300" zoom="15" longitude="4.75600" latitude="44.10200"> [ {    "type": "ExternalData", "service": "geoshape", "ids": "Q13518258", "properties": { "stroke": "#ffb100", "stroke-width": 6, } },  {    "type": "Feature", "geometry": { "type": "Point", "coordinates": [4.75566, 44.104498] }, "properties": { "title": "Porte de Castellan" } },  {    "type": "Feature", "geometry": { "type": "Point", "coordinates": [4.75829, 44.10258] }, "properties": { "title": "Porte Léon Roche" } } ]

Mixed types with markers
<mapframe width="300" height="300" zoom="12" longitude="-73.965278" latitude="40.782222"> [ {    "type": "ExternalData", "service": "page", "title": "Neighbourhoods/New York City.map" }, {    "type": "ExternalData", "service": "geoshape", "ids": "Q160409", "properties": { "fill": "#07c63e", "title": "Central Park" } },  {    "type": "Feature", "properties": {"title": "Roosevelt Island", "marker-color": "f01080"}, "geometry": { "type": "Point", "coordinates": [ -73.94511222839355,       40.76734665426719      ]    }  } ]

Rendering options
A seguinte tabela mostra como um pode ter sua exibição formatada numa página wiki. A tabela contém duas colunas: a primeira mostra um mapa interativo usando a tag, e a segunda mostra a renderização de uma imagem de exemplo com as mesmas opções da primeira coluna.

Use the width value  in order to make the map take up the full width of the page. <mapframe width="full" height="200" zoom="13" longitude="-122.39953994750977" latitude="37.81032643553478"> <mapframe width="full" height="200" zoom="13" longitude="-122.39953994750977" latitude="37.81032643553478" frameless>

Styling
<mapframe text="Interstate Highway I-696" width="300" height="300" longitude="-83.2297" latitude="42.4883" zoom="9"> { "type": "ExternalData", "service": "geoline", "ids": "Q2108", "properties": { "title": "Highway I-696", "description": "", "stroke": "#ffb100", "stroke-width": 8 } }

Ver também

 * Special:MyLanguage/Help:VisualEditor/Maps - Como adicionar e editar mapas com o Editor Visual
 * Usando o Kartographer com OpenStreetMap
 * Maps project (2015-2017) - Documentation on the Wikimedia engineering activity from the Discovery team from 2015 to 2017
 * Map improvements 2018 - Documentation on the Wikimedia engineering activity from the Collaboration team in 2018
 * Kartographer Developer guide
 * Terms of Use for Maps
 * Terms of Use for Maps