Ajuda:Extensão:Kartographer
![]() |
Nota: Ao editar esta página, você concorda em publicar suas contribuições no âmbito da licença CC0. Veja as páginas de ajuda sob domínio público para mais informações. | ![]() |
Páginas de ajuda principais:
- Como criar mapas com o Kartographer no Editor Visual
- Introdução ao Kartographer em wikitexto
- você está aqui: Kartographer – página detalhada de ajuda
A extensão Kartographer permite que você crie mapas interativos e estáticos nas páginas wiki da Wikimedia.
Esta página é uma referência exaustiva para o uso do Kartographer, incluindo as muitas opções disponíveis ao usar as marcações <mapframe>
, as quais incorporam mapas diretamente em páginas wiki, e <maplink>
, as quais criam ligações para mapas interativos e abordam os elementos GeoJSON suportados pelo Kartographer.
Você encontrará uma riqueza de exemplos na parte inferior da página.
Para ajuda com a integração do Kartographer ao OpenStreetMap, confira Ajuda:Extensão:Kartographer/OpenStreetMap .
Como utilizar o Kartographer
Encontrando páginas através do Kartographer
Para encontrar páginas que contenham mapas do Kartographer, basta inserir insource:mapframe
na pesquisa.
Exibir artigos sobre locais nas proximidades
No modo de tela cheia, é possível clicar no botão “Exibir artigos nas proximidades” e ver até 300 artigos geograficamente próximos como marcadores do mapa. No caso de diversos marcadores compartilharem uma mesma localização, eles serão agrupados à medida que o zoom for diminuído, e vice-versa.
Assim que o mapa for movido (arrastando com o mouse ou alterando o zoom), um botão para “recarregar resultados” aparece, permitindo exibir mais artigos nas proximidades.
Os artigos nas proximidades são gerados a partir da wiki sendo visitada, levando em consideração critérios de relevância e proximidade. Os marcadores de artigos nas proximidades são redondos. Eles são exibindos juntamente com os marcadores adicionados manualmente, os quais possuem um formato diferente.
Quando um marcador de artigo nas proximidades é clicado, um popup é exibido, contendo o título, uma breve descrição e uma imagem do artigo. Clique no título para acessar o artigo. Se o artigo estiver ligado a um registro no Wikidata, o popup também exibe a descrição breve contida no Wikidata. Para ocultar do mapa os artigos nas proximidades, clique novamente no botão “Exibir artigos nas proximidades”.
Página do projeto (em inglês)
Como criar mapas utilizando o Kartographer
Sintaxe básica do mapa
Para colocar um mapa ou uma ligação de mapa diretamente em uma página wiki, o Kartographer oferece duas marcações: <mapframe>
, a qual incorpora um mapa interativo que pode ser visto em tela cheia, e <maplink>
, a qual cria uma ligação a um mapa interativo.
Algumas wikis envolvem essas marcações em predefinições, como a Mapbox e a Mapframe. Consulte a página de ajuda do Kartographer em sua wiki local para ver se ela possui predefinições — ou use as marcações diretamente com este documento como seu guia.
<mapframe>
A marcação <mapframe>
incorpora um mapa em uma página wiki.
A marcação deve estar vazia ou conter GeoJSON.
Veja abaixo mais recursos sobre como escrever GeoJSON.
<mapframe text="San Francisco" width="350" height="350" zoom="13" longitude="-122.39953994750977" latitude="37.81032643553478" />
<maplink>
A marcação <maplink>
cria uma ligação a um mapa em tela cheia.
<maplink zoom="13" latitude="46.204391" longitude="6.143158"/>
Gives: 46°12′16″N 6°8′35″L
Seus atributos e usos são essencialmente idênticos a <mapframe>
; veja abaixo as pequenas diferenças.
Atributos
Abaixo, você encontrará uma lista de atributos para <mapframe>
e <maplink>
.
Os únicos atributos obrigatórios (marcados na tabela com um *
são width e height, largura e altura respectivamente; sem um local especificado, o Kartographer produzirá um mapa-múndi com zoom especificado na página.
Quando zoom não é especificado, o Kartographer aplica um nível de zoom automático baseado em quaisquer marcadores no mapa.[1]
Uso dentro da marcação:
attribute="value"
Atributo | Valor | Descrição | Exemplos |
---|---|---|---|
width* | píxeis, "full" | A largura do quadro do mapa. "100%" also works as an alias for "full", but no other percentage. | width=200 , width="full"
|
height* | píxeis | A altura do quadro do mapa. | height=300
|
zoom | 0-19 | O nível de detalhe do mapa. O nível de zoom 0 exibe todo o mapa disponível e o nível de zoom 19 mostra o nível mais alto de detalhes. Quando zoom não é especificado, o Kartographer aplica um nível de zoom automático baseado em quaisquer marcadores ou geoformas presentes. | zoom=12
|
latitude, longitude | graus decimais | A posição na terra. Veja este artigo na wiki do GIS para informações detalhadas. Se não for especificado, o Kartographer tentará derivar o ponto central do conteúdo de um artigo. | latitude=46.204391 longitude=6.143158
|
align | "left", "center", "right" | A posição horizontal do quadro do mapa na página. O valor padrão é definido pela direção de escrita do idioma da página (“left” para direita-para-esquerda; “right” para esquerda-para-direita). Especificado um valor “left” ou “right”, os conteúdos da wiki se ajustarão ao redor do mapa (veja a seção corresponde em Help:Imagens ). | align="right"
|
mapstyle | "osm", "osm-intl" | O estilo do mapa de base. Na Wikimedia, existem somente dois estilos disponíveis. Com rótulos (osm-intl) e sem rótulos (osm). | mapstyle="osm"
|
lang | código de idioma, "local" | O idioma a ser utilizado nos rótulos e marcadores do mapa. O valor “local” utiliza o idioma próprio da região do mapa. Note que nem todos os rótulos estão disponíveis em todos os idiomas. Veja também #Idiomas e substitutos. | lang="es"
|
alt | texto alternativo | Define o texto alternativo para a imagem gerada através do mapa. Funciona somente em wikis com a configuração wgKartographerStaticMapframe ativada.
|
alt="Mapa em nível de rua de Manhattan. O Empire State está marcado no meio da ilha, a sul do Central Park."
|
text | wikitext |
|
text="Map of New York marking the location of the Empire State Building"
|
frameless | ignored |
|
frameless
|
class | "no-icon" |
|
class="no-icon"
|
* = required
Self-closing tags
When not using GeoJSON, you can use <mapframe>
and <maplink>
as self-closing, standalone tags.
Self-closing:
<mapframe width="350" height="350" zoom="13" longitude="-122.3988" latitude="37.8013" />
Enclosing GeoJSON:
<mapframe width="350" height="350" zoom="13" longitude="-122.3988" latitude="37.8013">
{
"type": "Feature",
"geometry": { "type": "Point", "coordinates": [-122.3988, 37.8013] },
}
</mapframe>
GeoJSON
As marcações <mapframe>
e <maplink>
podem ser deixadas vazias ou conterem GeoJSON válido, o que permite anotar o mapa com marcadores, desenhar formas ou restringir áreas.
Para obter mais detalhes sobre esse tópico amplo, você pode ler esta introdução útil ao GeoJSON bem como a especificação completa do GeoJSON.
maplink
. Como mencionado anteriormente, o GeoJSON usado para maplink
pode ser usado para mapframe
sem alterações.
Marcadores
Os mapas que usam GeoJSON podem conter um ou mais marcadores para indicar locais especiais.
Esses marcadores são definidos através de palavras-chave específicas para marcadores, localizadas sob o nível "properties"
do GeoJSON.
O Kartographer é compatível com a especificação simplestyle com ícones Maki, que estão disponíveis sob a licença CC0. Veja a lista completa de ícones compatíveis.
<maplink text="Colorado State Capitol with marker icon" longitude="-104.98491" latitude="39.73939" zoom="17">
{
"type": "Feature", "properties":
{
"marker-symbol": "town-hall",
"marker-color": "46ea5f",
"marker-size": "medium"
},
"geometry":
{
"type": "Point",
"coordinates": [-104.98485267162323, 39.73928364167763]
}
}
</maplink>
Resultado: Colorado State Capitol with marker icon
Contadores automáticos
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. Para mais informações, veja a especificação simplestyle.
Attribute | Value | Description | Example |
---|---|---|---|
marker-symbol | nome do ícone, "‑number", "‑letter" | Determines whether the incremental marker labels proceed by number (1, 2, 3...) or letter (A, B, C...).
Automatic “-number” series go from 1-99, and letters from A-Z. If a group name is included like “-number-eat”, then multiple series are generated. |
"marker-symbol": "museum"
|
marker-color | hexadecimal color | A three- or six-character hexadecimal color value for each marker. | "marker-color": "#228b22"
|
marker-size | small, medium, large | See examples of each size. | "marker-size": "medium"
|
title | wikitext | When a marker is clicked, it will display wikitext specified in the "title" value. | "title": "[[:en:Downtown_Aquarium,_Denver|Downtown Aquarium Denver]] "
|
description | wikitext | When a marker is clicked, it will display wikitext or an image specified in wikitext in the "description" value. | "description": "[[File:Denver-DTA.jpg|150x150px]]"
|
For a rich variety of examples, see the Examples section.
Shapes, lines and points
GeoJSON allows you to add lines, geometric areas and points as annotations to your map. You can define them inline or import them from external databases.
Em linha
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 Feature
object. Consult the full GeoJSON specification for more information.
Objeto | Coordenadas (long./lat.) | Recurso do mapa |
---|---|---|
MultiPoint
|
várias posições | vários pontos (marcadores) |
MultiLineString
|
multiple sets of LineString positions
|
várias linhas |
MultiPolygon
|
multiple sets of Polygon positions
|
multiple polygons |
Dados externos
O GeoJSON permite importar objetos geográficos a partir de fontes externas usando o atributo type
com o valor ExternalData
.
Os mapas podem desenhar objetos geográficos conhecidos usando seu ID do Wikidata (ou via consulta do Wikidata SPARQL). The source for external polygons and lines is OpenStreetMap database, and marker coordinates are retrieved directly from Wikidata.
Além disso, os mapas podem ser ligar diretamente ao GeoJSON bruto armazenado no Wikimedia Commons (arquivos .map): veja Help:Map Data para mais detalhes.
A renderização de um objeto usando dados de fontes externas pode ser feita das seguintes maneiras:
"service": "geopoint"
- Draws a marker."service": "geoline"
- Desenha uma linha simples."service": "geoshape"
- Desenha um polígono com um interior sombreado."service": "geomask"
- Desenha um polígono e sombreia tudo fora do polígono."service": "page"
- path to a .map file on Wikimedia Commons that contains valid GeoJSON.
Via ID do Wikidata
Attribute | Value |
---|---|
type | ExternalData |
service | geopoint, geoline, geoshape, geomask |
ids | One or more Wikidata IDs, separated by commas |
Polygons and lines in OpenStreetMap (OSM) database are linked using Wikidata IDs.
Os IDs do Wikidata são relativamente novos para a comunidade OSM.
Até o início de 2025, já haviam aproximadamente 3,6 milhões de elementos com IDs do Wikidata.
You can add your own at https://www.openstreetmap.org/ – be sure to add the wikidata
tag and the corresponding QID
value.
Polígonos e linhas normalmente tornam-se disponíveis para o Kartographer dentro de dois dias.
Para obter instruções detalhadas, veja Ajuda:Extensão:Kartographer/OpenStreetMap .
Marker is drawn if linked Wikidata item has P625 coordinate statement.
<mapframe height="300" width="300" text="Combined map of Salzburg and Elixhausen">
{
"type": "ExternalData",
"service": "geoshape",
"ids": "Q34713,Q701153"
}
</mapframe>
<mapframe text="Geopoints using QIDs [[wikidata:Q667450|Q667450]] and [[wikidata:Q15958518|Q15958518]]" latitude="43.74" longitude="7.43" zoom="13" width="400" height="400">
{
"type": "ExternalData",
"service": "geopoint",
"ids": "Q667450, Q15958518"
}
</mapframe>
Via consulta do Wikidata
Attribute | Value |
---|---|
type | ExternalData |
service | geopoint, geoline, geoshape, geomask |
query | a Wikidata SPARQL query |
Variable | Allowed on | Comment | Required? |
---|---|---|---|
?id
|
geopoint, geoline, geoshape, geomask | Required | |
?title
|
geopoint, geoline, geoshape, geomask | Gives a heading on a popup. Accepts wikitext. | Optional |
?description
|
geopoint, geoline, geoshape, geomask | Further text on a popup. Accepts wikitext. | |
?geo
|
geopoint | Should be coordinates. | |
Marker variables behaves like described in auto-counters . | |||
?marker_symbol
|
geopoint | ||
?marker_size
|
geopoint | ||
?marker_color
|
geopoint | ||
Fill and stroke variables behaves like described in styling shapes . | |||
?fill
|
geoshape, geomask | ||
?fill_opacity
|
geoshape, geomask | ||
?stroke
|
geoline, geoshape, geomask | ||
?stroke_opacity
|
geoline, geoshape, geomask | ||
?stroke_width
|
geoline, geoshape, geomask |
<mapframe longitude="-110" latitude="52" zoom="3" width="400" height="300" text="Governors of US states with their party affiliation">
{
"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('[[w:', substr(str(?link),31,400), '{{!}}', ?headLabel, ']]') as ?title) (concat(?stateLabel, '\\n', '[[File:', substr(str(?img_), 52, 400), '{{!}}200px]]') 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 <https://en.wikipedia.org/> .} GROUP BY ?id ?head ?headLabel ?link ?stateLabel"
}
</mapframe>
Instead of a Wikidata Item ID, a map can also derive data from a Wikidata query in SPARQL. (You can create SPARQL queries using the Query Builder.)
<mapframe text="Public art in Hoogvliet, Rotterdam" latitude="51.86" longitude="4.36" zoom="13" width="400" height="400">
{
"type": "ExternalData",
"service": "geopoint",
"query": "SELECT DISTINCT ?id ?geo (?idLabel as ?title) (if(BOUND(?image), concat(?typeLabel, '\\n', '[[File:', substr(str(?image), 52, 400), '{{!}}200px]]'), ?typeLabel) as ?description) (if(?type = wd:Q860861, '#800000', if(?type = wd:Q245117, '#000080', '#008000')) as ?marker_color) WHERE { ?id wdt:P136 wd:Q557141; wdt:P625 ?geo; wdt:P276* wd:Q2103147; wdt:P31 ?type. OPTIONAL {?id wdt:P18 ?image}. SERVICE wikibase:label { bd:serviceParam wikibase:language 'en, nl'. ?id rdfs:label ?idLabel. ?type rdfs:label ?typeLabel} .} ORDER BY ?id"
}
</mapframe>
<mapframe width="400" height="300" text="Hillforts in the Basque Country, with image, size and color">
{
"type": "ExternalData",
"service": "geopoint",
"marker-size": "small",
"query": "SELECT ?id ?geo ?idLabel ?img ?herriaLabel (?idLabel as ?title) (concat(?herriaLabel, '\\n', '[[File:', substr(str(?img), 52, 400), '{{!}}200px]]') as ?description) ('small' as ?marker_size) ('#228b22' as ?marker_color) ('landmark-JP' as ?marker_symbol) WHERE {\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"eu,es,fr,en\". }\n ?id wdt:P31 wd:Q744099.\n ?id wdt:P131*/^wdt:P527 wd:Q47588;\n wdt:P625 ?geo.\n OPTIONAL { ?id wdt:P18 ?img .}\n ?id wdt:P131 ?herria.\n}"
}
</mapframe>
Dados de mapeamento do Commons
Dados de mapeamento em GeoJSON armazenados no Commons podem ser desenhados no mapa.
Attribute | Value |
---|---|
type | ExternalData |
service | page |
title | path to a .map file on Wikimedia Commons that contains valid GeoJSON.
For example: Neighbourhoods/New_York_City.map will draw from this map. |
- Informações adicionais: Help:Map Data
<mapframe width="300" height="400">
{
"type": "ExternalData",
"service": "page",
"title": "Neighbourhoods/New York City.map"
}
</mapframe>
Atenção: | The map loader does not currently support chained ExternalData calls. If a resource of type ExternalData is fetched that itself relies on ExternalData references, loading will fail. See T155927 and T193458. |
Atenção: | Os nomes dos arquivos .map são limitados a 400 caracteres de comprimento e um tamanho de 2MiB. Tenha isso em mente ao criar arquivos para esta finalidade no Wikimedia Commons. |
Mask layer
A mask is just an inside-out shape, specified in the same way but with the exterior of the shape shaded.
<mapframe align="right" height="420" width="420" latitude="47.7992" longitude="13.0482" zoom="11" text="Map of Salzburg with mask">
{
"type": "ExternalData",
"service": "geomask",
"ids": "Q34713",
"properties": {
"fill": "#555555",
"fill-opacity": 0.5,
"stroke": "#000000",
"stroke-width": 1,
"stroke-opacity": 1
}
}
</mapframe>
Combinando múltiplos tipos de dados
You can combine ExternalData, Feature, FeatureCollection objects together in the same <mapframe>
or <maplink>
element, for example to highlight features with titles and descriptions on top of externally sourced objects.
Os dados de mapeamento do Commons podem ser combinados com outros tipos de dados através de seu agrupamento em blocos paralelos de GeoJSON.
See #Mixed types for various combinations.
Styling shapes
In addition to the marker styling above, lines and areas support these simplestyle properties:
Atributo | Valor | Descrição |
---|---|---|
stroke | hexadecimal color | A cor da linha ou contorno. |
stroke-width | píxeis | A espessura da linha. |
stroke-opacity | 0.0-1.0 | Define a transparência da linha. Uma configuração de 1 desenha uma linha sólida; 0 é invisível; valores maiores (aproximando-se de 1) mostram menos do fundo. |
fill | hexadecimal color | A cor usada para preencher a forma. |
fill-opacity | 0.0-1.0 | Define a transparência da área de preenchimento. Uma configuração de 1 deixa a cor da área sólida; 0 é invisível; valores maiores (aproximando-se de 1) mostram menos do fundo. |
Elementos sobrepostos
Os elementos que se sobrepõem são desenhados na ordem em que aparecem no código. Se um mapa inclui duas linhas que se sobrepõem, a linha definida primeira aparecerá abaixo da linha definida depois. Isso se aplica a quaisquer elementos definidos no código que desenham no mapa.
Exemplos
Conteúdo extendido |
---|
<mapframe text="Defining respectively rectangle, yellow and black diagonals" width="500" height="270" longitude="79.030" latitude="-24.794" zoom="8" align="center">
{
"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]
]
}
}
]
}
</mapframe>
|
O código para o mapa acima inclui três elementos, todos os quais utilizam a funcionalidade feature
do GeoJSON. A primeira feature
é um polígono — o retângulo vermelho. Logo em seguida, há duas feature
s do tipo LineString
. Como a linha amarela (#fffa00) é definida primeiro, ela aparece atrás da linha preta (#000000). Observe que a hierarquia utilizada para desenhar elementos se aplica independentemente de os dados serem GeoJSON bruto ou virem de um ID do Wikidata ou de uma página de dados do Commons.
O mapa abaixo modifica a ordem que vimos no primeiro exemplo — a linha preta (#000000) é definida antes e, por isso, é posta para trás; em seguida, um retângulo (#ff0000) é definido com tal opacidade que a linha preta pareça vermelha escura; por último, é renderizada a diagonal amarela (#fffa00).
Conteúdo extendido |
---|
<mapframe text="Defining respectively black diagonal, rectangle, yellow diagonal" width="500" height="270" longitude="79.030" latitude="-24.794" zoom="8" align="center">
{
"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
]
]
}
}
]
}
</mapframe>
|
GeoJSON resources
Reference
- Full GeoJSON specification (RFC7946)
- GeoJSON on English Wikipedia
- simplestyle spec used by Kartographer
- Maki icon set used by Kartographer
Guides
Editors and tools
- GeoJSON.io editor
- Vector.rocks editor
- GeoJSON linter to validate your GeoJSON
Grupos para o Wikivoyage
O projeto Wikivoyage precisa exibir mapas cujos dados estejam definidos em outra parte da página.
Podem haver vários pontos de interesse definidos com as marcações <maplink>
, todos os quais aparecem em um único mapa comum na lateral da página.
(Veja um exemplo usando a cidade de Salzburgo.)
O agrupamento permite que os editores compartilhem dados entre várias marcações <mapframe>
e <maplink>
.
Por padrão, os dados armazenados dentro de uma marcação <mapframe>
ou <maplink>
são exibidos apenas no mapa criado por aquela marcação, e em nenhum outro.
Entretanto, no Wikivoyage, se uma marcação <maplink>
incluir o atributo group="..."
, os dados armazenados serão colocados dentro de um grupo nomeado, ao lado de outros dados atribuídos ao mesmo grupo.
Tags with the same group name will display on a single map data; each tag incrementally adds data to the group.
Each <mapframe>
tag on a Wikivoyage tag displays an embedded map displaying the groups specified in its tag.
Um mapa é capaz de exibir grupos adicionais sempre que especificado o atributo show="..."
.
Multiple group names may be specified, separated by comma.
A group name may only contain lower case Latin letters.
This grid illustrates the data that will be shown for each tag.
Example:
<maplink> -- shows 1
<maplink group='food'> -- shows 2 4 8 10
<maplink group='bar' show='bar'> -- shows 3 9
<maplink group='food' show='bar'> -- shows 2 3 4 8 9 10
<maplink show='bar'> -- shows 3 5 9
<maplink show='food,bar'> -- shows 2 3 4 6 8 9 10
<mapframe> -- shows 7
<mapframe group='food'> -- shows 2 4 8 10
<mapframe group='bar' show='bar'> -- shows 3 9
<mapframe group='food' show='bar'> -- shows 2 3 4 8 9 10
<mapframe show='bar'> -- shows 3 9 11
<mapframe show='food,bar'> -- shows 2 3 4 8 9 10 12
<mapframe>
and <maplink>
tags in templates. Consult Mapshape, Listing and See for a good starting place.
Idiomas e substitutos
Os mapas do Kartographer obtêm seus rótulos (labels) a partir do projeto de mapeamento em código aberto OpenStreetMap (https://www.openstreetmap.org/). Por padrão, o Kartographer tentará exibir rótulos no idioma da wiki na qual o mapa incorporado estiver sendo exibido. Se esse idioma não estiver disponível, o mapa usará o idioma substituto (idioma de fallback) configurado na wiki e, em seguida, o idioma local na região especificada no mapa do Kartographer. Se nenhum deles estiver disponível, o Kartographer não exibirá nenhum rótulo.
É possível especificar o idioma a ser utilizado para os rótulos com o atributo lang
, definindo seu valor para o código do idioma desejado. Por exemplo: lang="ja"
exibirá rótulos em japonês, se disponíveis nesse idioma.
Para usar o idioma local para a área do mapa, especifique lang=local
.
Para mais informações sobre como usar o idioma local em seus rótulos e sobre dados multilíngues do OpenStreetMap em geral, leia esta postagem.
Os mapas do Kartographer obtêm seus dados —incluindo dados de rótulos de mapa em todos os idiomas disponíveis— a partir do projeto de mapeamento em código-aberto OpenStreetMap.
Se o mapa que você deseja exibir não oferece rótulos no idioma desejado, sempre é possível adicionar rótulos nesse idioma adicionando-os você mesmo(a) no OpenStreetMap.
Note that country and city names are drawn from label nodes in OpenStreetMap, not from the data attached to boundary relations.
Antes de começar, veja o Guia de Principiantes do OpenStreetMap e as melhores práticas da convenção de nomes.
Exemplos
Simples
<mapframe text="San Francisco museums" width="350" height="350" zoom="13" longitude="-122.3988" latitude="37.8013">
{
"type": "Feature",
"geometry": { "type": "Point", "coordinates": [-122.3988, 37.8013] },
"properties": {
"title": "[[w:Exploratorium|Exploratorium]]",
"description": "[[File:Giant_Mirror_at_the_Exploratorium.jpeg|200px]]",
"marker-symbol": "museum",
"marker-size": "large",
"marker-color": "0050d0"
}
}
</mapframe>
Marcadores e contadores
Colorado State Capitol with a town hall marker, article link and image
<maplink text="Colorado State Capitol with a town hall marker, article link and image" longitude="-104.98491" latitude="39.73939" zoom="17">
{
"type": "Feature",
"properties": { "marker-symbol": "town-hall", "marker-color": "46ea5f", "marker-size": "medium", "title": "[[w:Colorado_State_Capitol|Colorado State Capitol]]", "description": "[[File:Coloradocapitolhill2.JPG|150px]]"},
"geometry": { "type": "Point", "coordinates": [-104.98485267162323, 39.73928364167763] }
}
</maplink>
Marcadores numerados
Colorado State Capitol with a number marker
<maplink text="Colorado State Capitol with a number marker" longitude="-104.98491" latitude="39.73939" zoom="17">{ "type": "Feature", "properties": { "marker-color": "228b22", "marker-symbol": "-number"}, "geometry": { "type": "Point", "coordinates": [-104.98485267162323, 39.73928364167763] }}</maplink>
Marcadores com letras
Colorado State Capitol with a letter marker
<maplink text="Colorado State Capitol with a letter marker" longitude="-104.98491" latitude="39.73939" zoom="17">{ "type": "Feature", "properties": { "marker-color": "508e33", "marker-symbol": "-letter"}, "geometry": { "type": "Point", "coordinates": [-104.98485267162323, 39.73928364167763] }}</maplink>
Several markers in a feature collection
<maplink text="Denver Amusements" longitude="-105.01247406005858" latitude="39.74956567318853" zoom="14"> {"type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [-105.00768899917603, 39.74859230437501] }, "properties": { "title": "[[w:Pepsi_Center|Pepsi Center]]", "marker-color": "420617", "marker-symbol": "-letter-see", "marker-size":"small"} }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-105.01238822937012, 39.7526011757416] }, "properties": { "title": "[[w:Downtown_Aquarium%2C_Denver|Downtown Aquarium Denver]]", "marker-color": "508e33", "marker-symbol": "-letter-see","marker-size":"medium", "description": "[[File:Denver-DTA.jpg|150px]]" } }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-105.01247406005858, 39.74956567318853] }, "properties": { "title": "[[w:Confluence_Park|Confluence Park]]", "marker-color": "0d2751", "marker-symbol": "-letter-see", "marker-size":"large" } }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-105.01646518707275, 39.74656303364532] }, "properties": { "title": "South Platte Bike Trail", "marker-color": "61b9e2", "marker-symbol": "-number-see", "marker-size":"medium" } },]}</maplink>
Groups of automatic counters
Conteúdo extendido |
---|
<mapframe text="Several groups of automatic counters" width="350" height="350" zoom="13" longitude="-122.39902496337889" latitude="37.80151060070086">
{
"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
]
}
}
]
}
</mapframe>
|
ExternalData
Wikidata QID
<maplink text="State of Colorado, outlined" zoom="7" > { "type": "ExternalData", "service": "geoshape", "ids": "Q1261" } </maplink>
Wikidata query
<mapframe longitude="-110" latitude="52" zoom="3" width="500" height="500" text="Governors of US states with their party affiliation">
{
"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('[[w:', substr(str(?link),31,500), '{{!}}', ?headLabel, ']]') as ?title) (concat(?stateLabel, '\\n', '[[File:', substr(str(?img_), 52, 500), '{{!}}200px]]') 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 <https://en.wikipedia.org/> .} GROUP BY ?id ?head ?headLabel ?link ?stateLabel"
}
</mapframe>
Map data from Commons
<mapframe width="300" height="400">
{
"type": "ExternalData",
"service": "page",
"title": "Neighbourhoods/New York City.map"
}
</mapframe>
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"
}
}
]
</mapframe>
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
]
}
}
]
</mapframe>
Mixed types with SPARQL query
<mapframe width="300" height="300" text="Manual railway and queried stations">
[
{
"type": "ExternalData",
"service": "geopoint",
"properties": {
"marker-symbol": "rail",
"marker-color": "302060" },
"query": "SELECT ?id ?geo ?idLabel (?idLabel as ?title) WHERE { ?id wdt:P81 wd:Q1760190 ; wdt:P31 wd:Q2175765; wdt:P625 ?geo . SERVICE wikibase:label { bd:serviceParam wikibase:language 'sv'. } }"
},
{
"type": "ExternalData",
"service": "geoline",
"properties": {
"stroke": "#AA0000",
"stroke-width": 3
},
"ids": "Q119890957, Q119891049"
}
]
</mapframe>
Opções de renderização
A seguinte tabela mostra como um <mapframe>
pode ter sua exibição formatada numa página wiki. A tabela contém duas colunas: a primeira mostra um mapa interativo usando a marcação <mapframe>
, e a segunda mostra a renderização de uma imagem de exemplo com as mesmas opções da primeira coluna.
Opções | Renderização do <mapframe>
|
Renderização da imagem |
---|---|---|
|
... text text text text text text ... | ... text text text |
|
Not supported: see T157502. | ... text text text |
|
... text text text text text text ... | ... text text text |
|
... text text text text text text ... | ... text text text |
|
... text text text text text text ... | ... text text text |
|
... text text text text text text ... Inconsistent, see T157640. |
... text text text text text text ... |
|
Not supported: see T157502. | ... text text text |
|
... text text text text text text ... | ... text text text |
|
... text text text text text text ... | ... text text text |
|
... text text text text text text ... | ... text text text |
Use width="full"
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>
Full width image without frame (and no text):
<mapframe width="full" height="200" zoom="13" longitude="-122.39953994750977" latitude="37.81032643553478" frameless></mapframe>
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": "[[File:I-696 near M-10 in 1988.jpg|200px]]",
"stroke": "#ffb100",
"stroke-width": 8
}
}
</mapframe>
Ver também
- Informações de implementação do Kartographer
- Special:MyLanguage/Help:VisualEditor/Maps - Como adicionar e editar mapas com o Editor Visual
- Usando o Kartographer com OpenStreetMap
- Maps project (2015-2017) - Documentação sobre as atividades de engenharia na Wikimedia feitas pela equipe de Descoberta entre 2015 e 2017
- Map improvements 2018 - Documentação sobre as atividades de engenharia na Wikimedia feitas pela equipe de Colaboração em 2018
- WMDE Geoinformation - Documentation on the WMDE engineering activity between 2021 up to 2023, part of WMDE Technical Wishes.
- Guia do desenvolvedor do Kartographer
- Termos de Uso para o Maps
References
- ↑ Geoshapes are available via a service or property geoshape (P3896)