SAPO::Widget.Maps->renderMap
This method will render an interactive Map from SAPO Mapas
Syntax
var render = new SAPO.Widget.Maps({
mapspot:'div_id_name',
maptitle:'Map Example',
mapcss:'smapa',
selfrender: false,
markers: Markers
});
render.renderTags(jsonMarkers);
- divid: (optional) divid for the map to render. If not supplied, will render inline
- maptitle: (optional) Map title. If it's false, won't show up
- mapcss: (optional) external CSS definition
- markers: (optional) optional Marker pins array
- selfrender: (optional) if TRUE, then class initialization will call renderMap()
- align: (optional) map alignment. Tells where the map will appear in another element (left, right, none) default is left.
Input Parameters
All the parameters come form the main class JSON object. See Syntax.
Markers JSON object
var Markers= {
"rss": {
"channel": {
"copyright": "©2005, PT.COM",
"description": "Pesquisa Notícias por title:lisboa",
"item": [
{
"author": "Rádio Renascença",
"dc:date": "2006-10-25T23:19:00Z",
"description": "Os trabalhadores ..",
"guid": "http:\/\//www.rr.pt\/noticia.asp?idnoticia=178760",
"link": "http:\/\/www.rr.pt\/noticia.asp?idnoticia=178760",
"title": "Lisboa: Funcionários admitem fazer greve",
"geo:lat": 38.711548,
"geo:lon": -9.13774
},
{
"author": "Público",
"dc:date": "2006-10-25T19:01:00Z",
"description": "...seu avião tenha aterrado de emergência hoje no aeroporto de Lisboa",
"guid": "http:\/\/www.publico.clix.pt\/shownews.asp?id=1274542",
"link": "http:\/\/www.publico.clix.pt\/shownews.asp?id=1274542",
"title": "Avião da EasyJet aterrou em Lisboa \"por precaução\"",
"geo:lat": 38.769882,
"geo:lon": -9.128402
}
] //item
} //channel
} //rss
}; //obj
Optional Markers parameters
Markers.map_options= {
mapcontrol: "large",
lat: 39, // optional
lon: -9 , // optional
zoom: 12, // optional (17-10)
navigation: false, // optional, default is true
locator_callback: null //callback function for widgets - optional
};
Markers.icon= {
image: "http://mapas.sapo.pt/imgs/feed.png", // img src or html
iconSize: {x: 16, y: 16},
infoWindowAnchor: {x: 8, y: 0},
iconAnchor: {x: 8, y: 0} // pixel offset from lat,lon
}
Markers.icon_selected= {
image: "http://mapas.sapo.pt/imgs/feed_sel.png", // img src or html
iconSize: {x: 16, y: 16},
infoWindowAnchor: {x: 8, y: 0},
iconAnchor: {x: 8, y: 0}, // pixel offset from lat,lon
display_titles: true // display titles using "map_pin" css class
}
Compatibility
| All browsers | Yes |
Depends
- http://js.sapo.pt/XML/W3CDom/
- http://js.sapo.pt/XML/Sax/
- http://js.sapo.pt/SAPO/
- http://js.sapo.pt/SAPO/Exception/
- http://js.sapo.pt/SAPO/Utility/CSS/
- http://js.sapo.pt/SAPO/Maps/Map/
- http://js.sapo.pt/SAPO/Widget/Maps/
Sample
Other methods from this Class
Community feedback