How to add polylines to this particular Google Maps? - google-maps

Can someone help me with what I need to add and where so I can make polylines between Markers for my journey on my site. Thanks in advance. I try to figure out by myself and I didn't sucseed. If anyone can tell me it would be very nice.
<!DOCTYPE>
<html>
<head>
<title></title>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
</style>
</head>
<body>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var markers = [
{
"title": 'Nusay Hotel, Ashgabat',
"lat": '37.9293938',
"lng": '58.3841203',
"description": 'DAY 01 - DAY 03 Arrive ASHGABAT We are cordially welcomed upon arrival at Ashgabat Airport and then transferred to our hotel. Balance of the day is free at leisure. An ex Soviet state, Turkmenistan is a one party state. Ashgabat, relatively a very small city, offers very interesting sites to see. Resource rich Turkmens have invested in beautifying their capital with a lot of marble of immense size and shapes. Ashgabat was recently noted by the Guinness Book of World Records as having the highest number of white marble-clad buildings in the world - 543 new buildings lined with white marble covering a total area of 4.5 million square meters. DAY 02 ASHGABAT Our study into the heritage of Central Asia starts as we explore the Parthian Fortresses of Nisa*. The site is of one of the earliest and most important cities of the Parthian Empire, a major power from the mid-3rd century BC to the 3rd century AD. Archaeological excavations in two parts of the site have revealed richly decorated architecture, illustrative of domestic, state and religious functions. Situated at the crossroads of important commercial and strategic axes, this powerful empire formed a barrier to Roman expansion while serving as an important communication and trading centre between east and west, north and south. We then head to theSpiritual Mosque, one of the biggest mosques in Central Asia, visit the National Museum of History and continue to Arch of Neutrality. In the afternoon we drive to GeokDepe to visit Arkadash stud farm (subject to opening) to see Akhalteke horses, the pride of Turkmen nation. Our tour concludes with visits to Presidential Square, ErtogrulGhazy Mosque, drive through some of the marble structures and the newly built Independence Park. Dinner tonight will be at the Poytagt Restaurant introducing us to food and cuisines of Central Asia. DAY 03 ASHGABAT/MARY/ASHGABAT An early morning short flight gets us to Mary to visit the State Historical and Cultural Park Ancient Merv*, which is the oldest and best-preserved of the oasis-cities along the Silk Route in Central Asia. The remains in this vast oasis span 4,000 years of human history. A number of monuments are still visible, particularly from the last two millennia, such as the Sultan Sanjar Mausoleum, the Large and Small Gyz Gala, Erk Gala, Gyaur Gala, Keshk Fortress, among others. On our way back to Mary we visit an artist’s home to see a demonstration of carpet weaving, embroidery, painting, cooking of local bread. After lunch we take our flight back to Ashgabat. Evening free.'
},
{
"title": 'JipekJoli Hotel, Nukus',
"lat": '42.465825',
"lng": '59.607718',
"description": 'DAY 04 After a short flight to Dashoguz we head to Kunya-Urgench*, situated in on the left bank of the Amu Daria River. The old town contains a series of monuments mainly from the 11th to 16th centuries, including a mosque, the gates of a caravanserai, fortresses, mausoleums and a 60-m high minaret. The monuments testify to outstanding achievements in architecture and craftsmanship whose influence reached Iran and Afghanistan, and later the architecture of the Mogul Empire of 16th-century India. After our visit of KunyaUrgench we drive to the Turkmenistan-Uzbekistan border point at Khojeyli, where we go through border formalities on both checkpoints, whilst being an interesting experience they do lack modern facilities. A short drive viewing the countryside gets us to Nukus – a place that is almost lost in the middle of the desert.'
},
{
"title": 'Grand Abdi Malik Hotel, Khiva',
"lat": '41.377115',
"lng": '60.3580361',
"description": 'DAY 05 Morning we visit the SavitskyKarakalpakstan Art Museum, which hosts the worlds second largest collection of Russian avant-garde art applied arts objects. It is also home to one of the largest collections of archeological objects and folk, applied and contemporary art originating from Central Asia. Drive through rural Uzbekistan to the historical city of Khiva. Here we explore the Ichan-Kala - the inner town (protected by brick walls some 10 m high) of the old Khiva oasis, which was the last resting-place of caravans before crossing the desert to Iran. Although few very old monuments still remain, it is a coherent and well-preserved example of the Muslim architecture of Central Asia. There are several outstanding structures such as the Djuma Mosque, the mausoleums and the madrasas and the two magnificent palaces built at the beginning of the 19th century by Alla-Kulli-Khan. Dinner at the popular Yassaulbashi restaurant.'
},
{
"title": 'Omar Khayyam Hotel, Bukhara',
"lat": '39.7703649',
"lng": '64.4149347',
"description": 'DAY 06 - DAY 07 A short drive to Urgench the capital of Khorezm province. It has a population of 150,000 inhabitants. We will have a drive through of the city before talking our flight to the historical Silk Road city of Bukhara. Upon arrival at Bukhara the most well known of the Silk Road oasis dating back to over 2,000 years. It is the most complete example of a medieval city in Central Asia, with an urban fabric that has remained largely intact. Monuments of particular interest include the famous tomb of Ismail Samani, a masterpiece of 10th-century Muslim architecture, and a large number of 17th-century madrasas. Afternoon we enjoy a walking tour of Bukhara, visiting several mosques, madrasas and the hat seller’s market. Evening we enjoy a folklore show at the Devanbegi Madrasa. End the day the Bukharan style with dinner enjoying Bukharan cuisine at the Minzifa Restaurant located in the Old Town. DAY 07 Today we continue our tour through the Historic Centre of Bukhara*, which houses over 140 architectural monuments. Bukhara had narrow streets will remind us of the Arabian Nights. After seeing the historical sites we visit Akbar’s Gallery where one can seea rich collection of old carpets and suzzane – his display center is like a museum assisted by UNESCO – his collection is well known to the Metropolitan Museum. To culminate our Bukhara experience we visit a miniaturist house where we see the workshop of the painters and his students all trying to retain the traditional art. Miniature painting was introduced here from Persia and the same tradition continued for many years but is facing its challenges with modernity. We join in for a home cooked meal.'
},
{
"title": 'Grand Samarkand Hotel, Samarkand',
"lat": '39.6725002',
"lng": '66.9364854',
"description": 'DAY 08 - DAY 09 Yet another tour of the historical city visiting the SitoraiMokhi-Khosa Palace followed by the residence of the Emir of Bukhara, the Mausoleum of the Sufi BakhoutdinNaqshbandi and the ChorBakr Necropolis. As we continue to Samarkand we stop atGijduvon to visit a famous madrassa built by Ulugh Beg the Timurid Sultan, astronomer and mathematician. We also visit the tomb and memorial of the prominent philosopher AbduholikGijduvoni, after whom the city is named. An interesting insight to the arts of Uzbekistan as we visit the famous pottery works of Alisher well known for his unique style and color. Past famous visitors include Prince Charles, Lady Diana and Hillary Clinton. Arrival Samarkand late afternoon. Evening, after some free time to stroll through the lanes of this historical city we are treated to dinner at the famous Old City Restaurant of Samarkand. DAY 09 This day is dedicated to explore the Historic town of Samarkand* - a crossroad and melting pot of the worlds cultures. Founded in the 7th century B.C. as ancient Afrasiab, Samarkand had its most significant development in the Timurid period from the 14th to the 15th centuries. The major monuments include the Registan Mosque and madrasas, Bibi-Khanum Mosque, the Shakhi-Zinda compound and the Gur-Emir ensemble, as well as Ulugh-Begs Observatory. Time permitting we visit a family home to learn how the most popular Uzbek meal, the pulao, is cooked. Evening is free and you may visit the local Afghan carpet makers, the local winery, the Kunhil paper makers or just back into time.'
},
{
"title": 'ShakreSabz Star Hotel, Shakhrisyabz',
"lat": '39.0400391',
"lng": '66.8069597',
"description": 'DAY 10 Morning we tour the Afrosiyob Museum and the tomb of Saint Daniel. Then we drive to KoniGhil village to see the traditional way of making Samarkand paper from mulberry leaves. Continue to the Historic Centre of Shakhrisyabz*, the birthplace of Tamerlane. The city contains a collection of exceptional monuments and ancient quarters that bear witness to the citys secular development, and particularly to the period of its apogee, under the rule of Amir Temur and the Temurids, in the 15th-16th century. Dinner will be a local experience at Alisher’s House. Evening free.'
},
{
"title": 'Serena Hotel, Dushanbe',
"lat": '38.5142164',
"lng": '68.7511861',
"description": 'DAY 11 - DAY 12 An early morning departure as we drive to the capital city of Tajikistan. Upon arrival at the border we first complete exit border formalities of Uzbekistan and then a short walk across to the Tajik side to do the entry border formalities. Change of vehicles as we drive to Dushanbe. We arrive at Dushanbe and are transferred to our hotel. Tajikistan is a double landlocked country, which was part of the Soviet Union and now has a Presidential form of government. It has a population of 8 million. Evening we are treated to Turkish/Tajik local cuisine dinner at the Café Merve Turkish. DAY 12 Our day in Dushanbe is spent visiting the National Museum of Tajikistan, the Gurminj Musical Instruments Museum, Statue of Ismail Samani and Rudaki Park. Subject to permit we also visit the recently built and an architectural marvel, the IsmailiJamatkhan and Centre. Lunch is at the Traktir Restaurant known for its speciality of Ukranian cuisine. We then visit the Botanical Gardens and culminate with an experience of the local bazaar. Evening is free to stroll the street and meet the friendly Tajiks at the teahouses.'
},
{
"title": 'Lotte Hotel, Tashkent',
"lat": '41.309827',
"lng": '69.2665513',
"description": 'DAY 13 We explore Uzbekistan’s capital visiting the Old City, including the Khast-Imom Complex where the world famous Quran of Caliph Uthman/Ottoman has been preserved, the Madrasah of Barak-Khan, Tilla Sheikh Mosque, the Mausoleum of the Saint Abu BakrKaffalShashi, the Islamic Institute of Imam al-Bukhari and explore Chor-Su Bazaar. An evening flight gets us to the largest and until recently the capital city of Kazakhstan. Upon arrival at Alma Aty we are welcomed and transferred to our hotel.'
},
{
"title": 'Otrar Hotel, Almaty',
"lat": '43.2608189',
"lng": '76.9495966',
"description": 'DAY 14 An early morning departure as we drive to the capital city of Tajikistan. Upon arrival at the border we first complete exit border formalities of Uzbekistan and then a short walk across to the Tajik side to do the entry border formalities. Change of vehicles as we drive to Dushanbe. We arrive at Dushanbe and are transferred to our hotel. Tajikistan is a double landlocked country, which was part of the Soviet Union and now has a Presidential form of government. It has a population of 8 million. Evening we are treated to Turkish/Tajik local cuisine dinner at the Café Merve Turkish.'
},
{
"title": 'Ak-Keme Hotel, Bishkek',
"lat": '42.8375965',
"lng": '74.5818513',
"description": 'DAY 15 We start early today on what is going to be a long day. Our tour begins with a visit to the Panfilov Park, followed by Zenkov Cathedral, St. Nicholas Cathedral and the Green Bazaar. From here we drive through Chang an-Tianshan Corridor*. We visit the Petroglyphs within the Archaeological Landscape of Tamgaly*. Set around the lush Tamgaly Gorge, amidst the vast, arid Chu-Ili Mountains, is a remarkable concentration of some 5,000 petroglyphs (rock carvings) dating from the second half of the second millennium BC to the beginning of the 20th century. Distributed among 48 complexes with associated settlements and burial grounds, they are testimonies to the husbandry, social organization and rituals of pastoral peoples. From here we drive to the border to Kyrgyzstan and continue to our hotel in Bishkek. Known alsos as Furunze, Bishkek is the capital city of Kyrgyzstan. Lunch will be at the Arzu Restaurant.'
},
{
"title": 'Four Seasons Karven Resort, IssykKul Lake',
"lat": '42.6035605',
"lng": '76.936764',
"description": 'DAY 16 - DAY 18 We enjoy our tour of Bishkek, which includes visits to Oak Park, Ala-Too Square, Statue of Manas, the Philharmonic Hall and Victory Monument. Drive to Balasagun and visit the historical Burana Tower*, which dates back to the 9th century AD. We will also visit the nearby museum. We then proceed eastwards into the mountains to Cholpon-Ata where we visit the local rock drawings of the Bronze periods, the local museum and a small local bazaar before arriving at our resort at Central Asia’s most popular will known resort. The Four Season’s Karven is known also for its impressive views of the imposing alpine ranges of the Tian Shan across the lake. For the balance of the day we have optional opportunities to walk around the valley and enjoy some of the boat rides being offered at the enchanting IssykKul Lake. Evening we enjoy dinner at a local restaurant attached to the Lake. DAY 17 Morning we visit the Preshevalsky Museum and Monument on the eastern edge of the Lake. A landmark museum, dedicated to the memory of Nikolai MichailovichPreshevalsky, who was an enthusiastic explorer accredited for his excellent works on the flora and fauna of the region. In the afternoon we visit the Annanaeva village where we get the opportunity to hike and visit local families and see their yurt accommodation and enjoy soup and tea with them. Evening for dinner we taste the cuisine of yet another of the popular restaurants at the IssykKul Lake. DAY 18 Enjoy our time at the lake. Afternoon we drive to Bishkek and enjoy a farewell dinner at Captain Nemo Restaurant. We are then transferred to the airport and after an enjoyable trail following the Central Asian portion of the Silk Road, we bid farewell to the land of the Stans.'
},
];
window.onload = function () {
LoadMap();
}
function LoadMap() {
var mapOptions = {
center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
// zoom: 8, //Not required.
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var infoWindow = new google.maps.InfoWindow();
var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
//Create LatLngBounds object.
var latlngbounds = new google.maps.LatLngBounds();
for (var i = 0; i < markers.length; i++) {
var data = markers[i]
var myLatlng = new google.maps.LatLng(data.lat, data.lng);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: data.title
});
(function (marker, data) {
google.maps.event.addListener(marker, "click", function (e) {
infoWindow.setContent("<div style = 'width:200px;min-height:40px'>" + data.description + "</div>");
infoWindow.open(map, marker);
});
})(marker, data);
//Extend each marker's position in LatLngBounds object.
latlngbounds.extend(marker.position);
}
//Get the boundaries of the Map.
var bounds = new google.maps.LatLngBounds();
//Center map and adjust Zoom based on the position of all markers.
map.setCenter(latlngbounds.getCenter());
map.fitBounds(latlngbounds);
}
</script>
<div id="dvMap" style="width: 1000px; height: 800px">
</div>
</body>
</html>
enter code here

Your markers array is one too long for a single directions request, but the first two points are joined by a flight so you can remove that from the request and draw that as a straight, "as the crow flies" polyline for that, then use the directions service for the remaining locations.
proof of concept fiddle
code snippet:
var map;
function initialize() {
map = new google.maps.Map(
document.getElementById("map_canvas"), {
center: new google.maps.LatLng(37.4419, -122.1419),
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infoWindow = new google.maps.InfoWindow();
//Create LatLngBounds object.
var latlngbounds = new google.maps.LatLngBounds();
var request = {
travelMode: google.maps.TravelMode.DRIVING
};
var polyline = new google.maps.Polyline({
map: map,
geodesic: true,
path: [new google.maps.LatLng(markers[0].lat, markers[0].lng), new google.maps.LatLng(markers[1].lat, markers[1].lng)],
strokeOpacity: 0,
icons: [{
icon: {
path: 'M 0,-1 0,1',
strokeOpacity: 1,
scale: 4
},
offset: '0',
repeat: '20px'
}],
})
var startMarker = new google.maps.Marker({
position: new google.maps.LatLng(markers[0].lat, markers[0].lng),
map: map
})
for (var i = 0; i < markers.length; i++) {
var data = markers[i]
var myLatlng = new google.maps.LatLng(data.lat, data.lng);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: data.title
});
(function(marker, data) {
google.maps.event.addListener(marker, "click", function(e) {
infoWindow.setContent("<div style = 'width:200px;min-height:40px'>" + data.description + "</div>");
infoWindow.open(map, marker);
});
})(marker, data);
//Extend each marker's position in LatLngBounds object.
latlngbounds.extend(marker.position);
if (i == 1) {
request.origin = new google.maps.LatLng(markers[i].lat, markers[i].lng);
} else if (i == markers.length - 1) {
request.destination = new google.maps.LatLng(markers[i].lat, markers[i].lng);
} else if (i != 0) {
if (!request.waypoints) request.waypoints = [];
if (request.waypoints.length < 8) {
request.waypoints.push({
location: new google.maps.LatLng(markers[i].lat, markers[i].lng),
stopover: true
});
} else {
alert("too many waypoints, dropping marker number " + i);
}
}
}
var directionsService = new google.maps.DirectionsService();
var directionsDisplay = new google.maps.DirectionsRenderer({
map: map,
suppressMarkers: true
})
directionsService.route(request, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(result);
}
});
}
google.maps.event.addDomListener(window, "load", initialize);
var markers = [{
"title": 'Nusay Hotel, Ashgabat',
"lat": '37.9293938',
"lng": '58.3841203',
"description": 'DAY 01 - DAY 03 Arrive ASHGABAT We are cordially welcomed upon arrival at Ashgabat Airport and then transferred to our hotel. Balance of the day is free at leisure. An ex Soviet state, Turkmenistan is a one party state. Ashgabat, relatively a very small city, offers very interesting sites to see. Resource rich Turkmens have invested in beautifying their capital with a lot of marble of immense size and shapes. Ashgabat was recently noted by the Guinness Book of World Records as having the highest number of white marble-clad buildings in the world - 543 new buildings lined with white marble covering a total area of 4.5 million square meters. DAY 02 ASHGABAT Our study into the heritage of Central Asia starts as we explore the Parthian Fortresses of Nisa*. The site is of one of the earliest and most important cities of the Parthian Empire, a major power from the mid-3rd century BC to the 3rd century AD. Archaeological excavations in two parts of the site have revealed richly decorated architecture, illustrative of domestic, state and religious functions. Situated at the crossroads of important commercial and strategic axes, this powerful empire formed a barrier to Roman expansion while serving as an important communication and trading centre between east and west, north and south. We then head to theSpiritual Mosque, one of the biggest mosques in Central Asia, visit the National Museum of History and continue to Arch of Neutrality. In the afternoon we drive to GeokDepe to visit Arkadash stud farm (subject to opening) to see Akhalteke horses, the pride of Turkmen nation. Our tour concludes with visits to Presidential Square, ErtogrulGhazy Mosque, drive through some of the marble structures and the newly built Independence Park. Dinner tonight will be at the Poytagt Restaurant introducing us to food and cuisines of Central Asia. DAY 03 ASHGABAT/MARY/ASHGABAT An early morning short flight gets us to Mary to visit the State Historical and Cultural Park Ancient Merv*, which is the oldest and best-preserved of the oasis-cities along the Silk Route in Central Asia. The remains in this vast oasis span 4,000 years of human history. A number of monuments are still visible, particularly from the last two millennia, such as the Sultan Sanjar Mausoleum, the Large and Small Gyz Gala, Erk Gala, Gyaur Gala, Keshk Fortress, among others. On our way back to Mary we visit an artist’s home to see a demonstration of carpet weaving, embroidery, painting, cooking of local bread. After lunch we take our flight back to Ashgabat. Evening free.'
}, {
"title": 'JipekJoli Hotel, Nukus',
"lat": '42.465825',
"lng": '59.607718',
"description": 'DAY 04 After a short flight to Dashoguz we head to Kunya-Urgench*, situated in on the left bank of the Amu Daria River. The old town contains a series of monuments mainly from the 11th to 16th centuries, including a mosque, the gates of a caravanserai, fortresses, mausoleums and a 60-m high minaret. The monuments testify to outstanding achievements in architecture and craftsmanship whose influence reached Iran and Afghanistan, and later the architecture of the Mogul Empire of 16th-century India. After our visit of KunyaUrgench we drive to the Turkmenistan-Uzbekistan border point at Khojeyli, where we go through border formalities on both checkpoints, whilst being an interesting experience they do lack modern facilities. A short drive viewing the countryside gets us to Nukus – a place that is almost lost in the middle of the desert.'
}, {
"title": 'Grand Abdi Malik Hotel, Khiva',
"lat": '41.377115',
"lng": '60.3580361',
"description": 'DAY 05 Morning we visit the SavitskyKarakalpakstan Art Museum, which hosts the worlds second largest collection of Russian avant-garde art applied arts objects. It is also home to one of the largest collections of archeological objects and folk, applied and contemporary art originating from Central Asia. Drive through rural Uzbekistan to the historical city of Khiva. Here we explore the Ichan-Kala - the inner town (protected by brick walls some 10 m high) of the old Khiva oasis, which was the last resting-place of caravans before crossing the desert to Iran. Although few very old monuments still remain, it is a coherent and well-preserved example of the Muslim architecture of Central Asia. There are several outstanding structures such as the Djuma Mosque, the mausoleums and the madrasas and the two magnificent palaces built at the beginning of the 19th century by Alla-Kulli-Khan. Dinner at the popular Yassaulbashi restaurant.'
}, {
"title": 'Omar Khayyam Hotel, Bukhara',
"lat": '39.7703649',
"lng": '64.4149347',
"description": 'DAY 06 - DAY 07 A short drive to Urgench the capital of Khorezm province. It has a population of 150,000 inhabitants. We will have a drive through of the city before talking our flight to the historical Silk Road city of Bukhara. Upon arrival at Bukhara the most well known of the Silk Road oasis dating back to over 2,000 years. It is the most complete example of a medieval city in Central Asia, with an urban fabric that has remained largely intact. Monuments of particular interest include the famous tomb of Ismail Samani, a masterpiece of 10th-century Muslim architecture, and a large number of 17th-century madrasas. Afternoon we enjoy a walking tour of Bukhara, visiting several mosques, madrasas and the hat seller’s market. Evening we enjoy a folklore show at the Devanbegi Madrasa. End the day the Bukharan style with dinner enjoying Bukharan cuisine at the Minzifa Restaurant located in the Old Town. DAY 07 Today we continue our tour through the Historic Centre of Bukhara*, which houses over 140 architectural monuments. Bukhara had narrow streets will remind us of the Arabian Nights. After seeing the historical sites we visit Akbar’s Gallery where one can seea rich collection of old carpets and suzzane – his display center is like a museum assisted by UNESCO – his collection is well known to the Metropolitan Museum. To culminate our Bukhara experience we visit a miniaturist house where we see the workshop of the painters and his students all trying to retain the traditional art. Miniature painting was introduced here from Persia and the same tradition continued for many years but is facing its challenges with modernity. We join in for a home cooked meal.'
}, {
"title": 'Grand Samarkand Hotel, Samarkand',
"lat": '39.6725002',
"lng": '66.9364854',
"description": 'DAY 08 - DAY 09 Yet another tour of the historical city visiting the SitoraiMokhi-Khosa Palace followed by the residence of the Emir of Bukhara, the Mausoleum of the Sufi BakhoutdinNaqshbandi and the ChorBakr Necropolis. As we continue to Samarkand we stop atGijduvon to visit a famous madrassa built by Ulugh Beg the Timurid Sultan, astronomer and mathematician. We also visit the tomb and memorial of the prominent philosopher AbduholikGijduvoni, after whom the city is named. An interesting insight to the arts of Uzbekistan as we visit the famous pottery works of Alisher well known for his unique style and color. Past famous visitors include Prince Charles, Lady Diana and Hillary Clinton. Arrival Samarkand late afternoon. Evening, after some free time to stroll through the lanes of this historical city we are treated to dinner at the famous Old City Restaurant of Samarkand. DAY 09 This day is dedicated to explore the Historic town of Samarkand* - a crossroad and melting pot of the worlds cultures. Founded in the 7th century B.C. as ancient Afrasiab, Samarkand had its most significant development in the Timurid period from the 14th to the 15th centuries. The major monuments include the Registan Mosque and madrasas, Bibi-Khanum Mosque, the Shakhi-Zinda compound and the Gur-Emir ensemble, as well as Ulugh-Begs Observatory. Time permitting we visit a family home to learn how the most popular Uzbek meal, the pulao, is cooked. Evening is free and you may visit the local Afghan carpet makers, the local winery, the Kunhil paper makers or just back into time.'
}, {
"title": 'ShakreSabz Star Hotel, Shakhrisyabz',
"lat": '39.0400391',
"lng": '66.8069597',
"description": 'DAY 10 Morning we tour the Afrosiyob Museum and the tomb of Saint Daniel. Then we drive to KoniGhil village to see the traditional way of making Samarkand paper from mulberry leaves. Continue to the Historic Centre of Shakhrisyabz*, the birthplace of Tamerlane. The city contains a collection of exceptional monuments and ancient quarters that bear witness to the citys secular development, and particularly to the period of its apogee, under the rule of Amir Temur and the Temurids, in the 15th-16th century. Dinner will be a local experience at Alisher’s House. Evening free.'
}, {
"title": 'Serena Hotel, Dushanbe',
"lat": '38.5142164',
"lng": '68.7511861',
"description": 'DAY 11 - DAY 12 An early morning departure as we drive to the capital city of Tajikistan. Upon arrival at the border we first complete exit border formalities of Uzbekistan and then a short walk across to the Tajik side to do the entry border formalities. Change of vehicles as we drive to Dushanbe. We arrive at Dushanbe and are transferred to our hotel. Tajikistan is a double landlocked country, which was part of the Soviet Union and now has a Presidential form of government. It has a population of 8 million. Evening we are treated to Turkish/Tajik local cuisine dinner at the Café Merve Turkish. DAY 12 Our day in Dushanbe is spent visiting the National Museum of Tajikistan, the Gurminj Musical Instruments Museum, Statue of Ismail Samani and Rudaki Park. Subject to permit we also visit the recently built and an architectural marvel, the IsmailiJamatkhan and Centre. Lunch is at the Traktir Restaurant known for its speciality of Ukranian cuisine. We then visit the Botanical Gardens and culminate with an experience of the local bazaar. Evening is free to stroll the street and meet the friendly Tajiks at the teahouses.'
}, {
"title": 'Lotte Hotel, Tashkent',
"lat": '41.309827',
"lng": '69.2665513',
"description": 'DAY 13 We explore Uzbekistan’s capital visiting the Old City, including the Khast-Imom Complex where the world famous Quran of Caliph Uthman/Ottoman has been preserved, the Madrasah of Barak-Khan, Tilla Sheikh Mosque, the Mausoleum of the Saint Abu BakrKaffalShashi, the Islamic Institute of Imam al-Bukhari and explore Chor-Su Bazaar. An evening flight gets us to the largest and until recently the capital city of Kazakhstan. Upon arrival at Alma Aty we are welcomed and transferred to our hotel.'
}, {
"title": 'Otrar Hotel, Almaty',
"lat": '43.2608189',
"lng": '76.9495966',
"description": 'DAY 14 An early morning departure as we drive to the capital city of Tajikistan. Upon arrival at the border we first complete exit border formalities of Uzbekistan and then a short walk across to the Tajik side to do the entry border formalities. Change of vehicles as we drive to Dushanbe. We arrive at Dushanbe and are transferred to our hotel. Tajikistan is a double landlocked country, which was part of the Soviet Union and now has a Presidential form of government. It has a population of 8 million. Evening we are treated to Turkish/Tajik local cuisine dinner at the Café Merve Turkish.'
}, {
"title": 'Ak-Keme Hotel, Bishkek',
"lat": '42.8375965',
"lng": '74.5818513',
"description": 'DAY 15 We start early today on what is going to be a long day. Our tour begins with a visit to the Panfilov Park, followed by Zenkov Cathedral, St. Nicholas Cathedral and the Green Bazaar. From here we drive through Chang an-Tianshan Corridor*. We visit the Petroglyphs within the Archaeological Landscape of Tamgaly*. Set around the lush Tamgaly Gorge, amidst the vast, arid Chu-Ili Mountains, is a remarkable concentration of some 5,000 petroglyphs (rock carvings) dating from the second half of the second millennium BC to the beginning of the 20th century. Distributed among 48 complexes with associated settlements and burial grounds, they are testimonies to the husbandry, social organization and rituals of pastoral peoples. From here we drive to the border to Kyrgyzstan and continue to our hotel in Bishkek. Known alsos as Furunze, Bishkek is the capital city of Kyrgyzstan. Lunch will be at the Arzu Restaurant.'
}, {
"title": 'Four Seasons Karven Resort, IssykKul Lake',
"lat": '42.6035605',
"lng": '76.936764',
"description": 'DAY 16 - DAY 18 We enjoy our tour of Bishkek, which includes visits to Oak Park, Ala-Too Square, Statue of Manas, the Philharmonic Hall and Victory Monument. Drive to Balasagun and visit the historical Burana Tower*, which dates back to the 9th century AD. We will also visit the nearby museum. We then proceed eastwards into the mountains to Cholpon-Ata where we visit the local rock drawings of the Bronze periods, the local museum and a small local bazaar before arriving at our resort at Central Asia’s most popular will known resort. The Four Season’s Karven is known also for its impressive views of the imposing alpine ranges of the Tian Shan across the lake. For the balance of the day we have optional opportunities to walk around the valley and enjoy some of the boat rides being offered at the enchanting IssykKul Lake. Evening we enjoy dinner at a local restaurant attached to the Lake. DAY 17 Morning we visit the Preshevalsky Museum and Monument on the eastern edge of the Lake. A landmark museum, dedicated to the memory of Nikolai MichailovichPreshevalsky, who was an enthusiastic explorer accredited for his excellent works on the flora and fauna of the region. In the afternoon we visit the Annanaeva village where we get the opportunity to hike and visit local families and see their yurt accommodation and enjoy soup and tea with them. Evening for dinner we taste the cuisine of yet another of the popular restaurants at the IssykKul Lake. DAY 18 Enjoy our time at the lake. Afternoon we drive to Bishkek and enjoy a farewell dinner at Captain Nemo Restaurant. We are then transferred to the airport and after an enjoyable trail following the Central Asian portion of the Silk Road, we bid farewell to the land of the Stans.'
}, ];
html,
body,
#map_canvas {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px
}
<script src="https://maps.googleapis.com/maps/api/js"></script>
<div id="map_canvas"></div>

Related

Combining Several Character Objects into a Single Object

I am trying to scrape text from a news article - I am doing this as follows:
library(rvest)
url <- "https://www.bbc.com/future/article/20220823-how-auckland-worlds-most-spongy-city-tackles-floods"
final = url %>%
read_html() %>%
html_elements(".article__body-content p") %>%
html_text()
This seems to have worked, but I am trying to combine the results of this code into a single object. For example, the current results look like this:
[1] "Tangled mats of muddy vegetation line the footpaths of Underwood Park, a narrow stripe of green winding along a creek beneath the small volcanic cone of Ōwairaka (Mt Albert) in Auckland, New Zealand. In the water, clumps of sticks and the occasional plastic bag are marooned on protruding rocks and branches."
[2] "A winter storm swept through the city overnight, dropping heavy rain, and Te Auaunga (Oakley Creek), one of the city’s longest urban streams, has overflowed its banks."
[3] "\"But that’s supposed to happen,\" says Julie Fairey, chair of the Puketāpapa local board, who is showing me around Underwood and the neighbouring Walmsley Park."
I would like to make a single object of this text - for example (remove all " "):
final <- "Tangled mats of muddy vegetation line the footpaths of Underwood Park, a narrow stripe of green winding along a creek beneath the small volcanic cone of Ōwairaka (Mt Albert) in Auckland, New Zealand. In the water, clumps of sticks and the occasional plastic bag are marooned on protruding rocks and branches.
A winter storm swept through the city overnight, dropping heavy rain, and Te Auaunga (Oakley Creek), one of the city’s longest urban streams, has overflowed its banks.
But that’s supposed to happen, says Julie Fairey, chair of the Puketāpapa local board, who is showing me around Underwood and the neighbouring Walmsley Park."
When I inspect the results, I initially thought it was a list - but it's actually a character object. Had this been a list, I could have used the "unlist" command. But now I am not sure how to proceed.
Can someone please show me how to proceed?
Thanks!
The output from html_text is a vector of strings. We could join them as a single string with paste and collapse.
library(rvest)
library(magrittr)
final <- url %>%
read_html() %>%
html_elements(".article__body-content p") %>%
html_text() %>%
paste(collapse = "\n")
Now, we check the output
cat(final, sep = "\n")
Tangled mats of muddy vegetation line the footpaths of Underwood Park, a narrow stripe of green winding along a creek beneath the small volcanic cone of Ōwairaka (Mt Albert) in Auckland, New Zealand. In the water, clumps of sticks and the occasional plastic bag are marooned on protruding rocks and branches.
A winter storm swept through the city overnight, dropping heavy rain, and Te Auaunga (Oakley Creek), one of the city’s longest urban streams, has overflowed its banks.
"But that’s supposed to happen," says Julie Fairey, chair of the Puketāpapa local board, who is showing me around Underwood and the neighbouring Walmsley Park.
The connected parks are designed to collect excess stormwater, soak it up like a sponge, and slowly release it back into the creek. The debris left behind is evidence this "secret infrastructure" is working, Fairey says. The two parks are flanked on both sides by public housing developments. "This stuff is designed to flood so that the houses don’t," she says.
It wasn’t always this way, Fairey tells me, as we watch a black shag drying its wings on a rock. Less than a decade ago, the waterway was a concrete-lined culvert that ran through seldom-visited muddy fields. When it flooded, water sloshed into the surrounding suburbs. It collected engine oil, sediment and rubbish and sucked this unhealthy mixture out into the city’s famous harbour, rendering the beaches unsafe to swim.
But in 2016, work began to free Te Auaunga from rigid concrete, and restore it to a more natural, meandering shape. Its banks are now lush with native vegetation like harakeke (flax) and tī kouka (cabbage trees), as well as reeds, ferns and other filtering wetland plants.
The changes have increased this part of the city’s ability to absorb excess rainfall, an attribute sometimes called “sponginess”. Auckland was recently named the most spongy global city in a report by multinational architecture and design firm Arup, thanks to its geography, soil type, and urban design – but experts warn it may not lead the pack for long.
As climate change intensifies extreme weather events worldwide, what can other cities learn from Auckland's successes – and failures?
The connected parks around Te Auaunga creek in Auckland are designed to soak up excess stormwater like a sponge (Credit: Kate Evans)
....

Extract Image url from WordPress REST API JSON response

I'm new to WordPress REST API and I don't know how to extract the image URLs from the "content" key of the API (https://www.example.com/wp-json/wp/v2/posts) response which looks like this:
"content": {
"rendered": "\n<p>From munching on a casual pizza to romantic candlelit dinner in Kolkata with your better half, Valentine’s week is filled with all of these!</p>\n\n\n\n<p>The love week of February offers the perfect excuse to sample Kolkata’s very best restaurants with your other half.</p>\n\n\n\n<p>Find your dream date night in our Valentine’s Day special guide to the cutest restaurants in Kolkata.</p>\n\n\n\n<h2><i><center>Blue and Beyond</center></i></h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img src=\"https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond.png\" alt=\"\" class=\"wp-image-919\" srcset=\"https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond.png 540w, https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond-300x197.png 300w, https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond-150x99.png 150w\" sizes=\"(max-width: 540px) 100vw, 540px\" /><figcaption>Blue & Beyond, New Market</figcaption></figure></div>\n\n\n\n<p>Situated in the New Market area, this place boasts of beautiful rooftop open-air seating. It also has an indoor seating</p>\n\n\n\n<p>You can expect a feel of colonial Kolkata with Stuart Hogg Market below."
}
I tried this solution, but the "featured_media" is 0 in my case.
Installed this plugin, but the field "better_featured_image" is showing as null in all the posts.
This is the only solution that might solve the problem, but I don't know how to extract Image URLs using Regex.
Please help me with the Regex to extract the URLs. Or if there's another way which might help, please mention in the ans.
You can decode json string usgin json_decode() fucntion. then you can preg_match to match with '/src="([^"]*)"/' regex that extract your src. check below code.
<?php
$image = '{"content": {"rendered": "\n<p>From munching on a casual pizza to romantic candlelit dinner in Kolkata with your better half, Valentine’s week is filled with all of these!</p>\n\n\n\n<p>The love week of February offers the perfect excuse to sample Kolkata’s very best restaurants with your other half.</p>\n\n\n\n<p>Find your dream date night in our Valentine’s Day special guide to the cutest restaurants in Kolkata.</p>\n\n\n\n<h2><i><center>Blue and Beyond</center></i></h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img src=\"https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond.png\" alt=\"\" class=\"wp-image-919\" srcset=\"https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond.png 540w, https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond-300x197.png 300w, https://kolkatasutra.com/wp-content/uploads/2021/02/blue-n-beyond-150x99.png 150w\" sizes=\"(max-width: 540px) 100vw, 540px\" /><figcaption>Blue & Beyond, New Market</figcaption></figure></div>\n\n\n\n<p>Situated in the New Market area, this place boasts of beautiful rooftop open-air seating. It also has an indoor seating</p>\n\n\n\n<p>You can expect a feel of colonial Kolkata with Stuart Hogg Market below."}}';
$image = json_decode($image, true);
preg_match('/src="([^"]*)"/',$image['content']['rendered'], $result);
echo $result[1]; die;
?>

JQuery Select all <p> not having <strong> int it

I have a markup like this,
<p><strong>What is baptism and why do we get baptized?</strong></p>
<p>Being baptized in Jesus’ name shows your identification with Christ’s death, burial, and resurrection (<em>Acts 2:38; Romans 6:3-8; Colossians 2:12; 1 Peter 3:21</em>). In baptism, you as a believer are publicly testifying that when Christ died on the cross for your sins, you died to your former life of sin against God. But as Christ was raised from the dead, so you were also raised to eternal life in relationship with him. Baptism is thus a public declaration and a picture of the salvation found in Christ.</p>
<p>Jesus commanded his followers, “Go therefore and make disciples of all nations, baptizing them in the name of the Father and of the Son and of the Holy Spirit, teaching them to observe all that I have commanded you” (<em>Matthew 28:19-20</em>). The book of Acts shows that this is precisely what the apostles did after being filled with the Holy Spirit (see <em>Acts 2:41; 8:12, 38; Acts 9:18; 10:48; 16:15, 33; 18:8</em>). As Peter told a crowd, “Repent and let each of you be baptized in the name of Jesus Christ” (<em>Acts 2:38</em>).</p>
<p>In the New Testament, we consistently see that when people responded to the preaching of the gospel with faith and repentance, they were immediately baptized. Thus, conversion and baptism are very closely related. In light of these biblical truths, all Christians should seek to be baptized, and we encourage you to be baptized if you’ve put your trust in Christ.</p>
<p><strong>If I sin as a Christian, should I get baptized again?</strong></p>
<p>When we sin as Christians, we are called to repent and turn to Jesus to forgive us and change our ways. God’s word says, “If we confess our sins, he is faithful and just to forgive us our sins and to cleanse us from all unrighteousness” (<em>1 John 1:9</em>). Because of the forgiveness brought about by Jesus’ once-for-all, atoning sacrifice for sin, we do not need to be baptized every time we sin.</p>
<p><strong>Can I get baptized if I’ve been baptized before? What if I was baptized as a baby?</strong></p>
<p>Baptism is a public identification of your faith in Christ and commitment to follow him. We would only encourage you to be baptized more than once if your initial baptism was not out of a sincere belief in Jesus.</p>
<p><strong>Does baptism save?</strong></p>
<p>Several passages, on the surface, seem to teach that baptism saves (<em>Mark 16:16; Acts 2:38; Acts 22:16; 1 Peter 3:21</em>). In all these cases, however, faith in Jesus comes first. The biblical order is repentance and belief, then baptism. Scripture is abundantly clear that purification from sin is not the result of baptism (<em>Acts 15:9; 1 John 1:9</em>). However, the act of baptism is so closely related to the act of faith that they are often expressed as one act. Baptism is reserved for those who sincerely repent of their sins and place faith in the Lord Jesus. It is this faith in Christ that saves us from our sins.</p>
<p><strong>Can children be baptized?</strong></p>
<p>Reality LA believes that baptism is intended for those who believe in Christ as Lord and Savior. In the New Testament, even when whole households were baptized (<em>Acts 10:48; 16:15, 33; Acts 18:8; 1 Corinthians 1:16</em>), those who were baptized were those who heard the gospel (<em>Acts 10:44</em>) and believed (<em>Acts 16:31, 34</em>). When it comes to children, baptism is appropriate when a child displays evidence of a genuine relationship with God and a degree of understanding of what it means to trust in Christ. It is impossible to set a precise age for when a child should be baptized. The right age will vary with each child.</p>
<p><strong>Can I invite people? Should I?</strong></p>
<p>Being baptized is a celebration of who Christ is and what he’s done in your life, so we encourage you to invite friends and family members to come celebrate this event with you. Whether they are Christians or not, this is a great opportunity to show people what your faith in Jesus means to you as well as a chance for people to hear the gospel.</p>
I just want to select all the <p> which don't have Strong in it
Use :not() and :has() Selector filters: $("p:not(:has(strong))")
const $notHasStrong = $("p:not(:has(strong))");
console.log($notHasStrong.length) // 1
<p><strong>Space</strong></p>
<p>Has no Strong</p>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
Or using the .not() filter method: $("p").not(":has(strong)")
You can get all <p>s and then filter those which does not have <strong>:
$('p').filter(function(){ return !$(this).find('strong').length;});
var result = $('p').filter(function(){ return !$(this).find('strong').length;});
console.log('result count: ' + result.length);
console.log('result content: ' +result.html());
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<p><strong>P1</strong></p>
<p>P2</p>

Chrome Devtools, copying over a set of answers

I have to do this repeatedly, so I was wondering if there was a working around....
here is a set of amenities for an apartment, they have to be transferred to a larger list containing those amenities by clicking off multiple choice cirlces. Is there away to edit the script to do it all at once>
example
accessible
air conditioning
dishwasher
garage
hardwood floors
parking
patio / balcony
gym
in unit laundry
cats allowed
dogs allowed
pet friendly
basketball court
bathtub
bbq/grill
bike storage
business center
carpet
ceiling fan
clubhouse
game room
granite counters
microwave
oven
package receiving
playground
pool table
range
refrigerator
stainless steel
walk in closets
I think you want to just checkmark all of the checkboxes on the amenities list so something like this will work:
$('div.whitelist-searchable-amenity input[type=checkbox]').each(function(){
$(this).prop('checked', true);
});
https://jsfiddle.net/r62qgou3/
Edit:
I am not sure of what you mean by "copying text to script" but I modified the script to check if the values that you are looking for are within the document. This should search the values of the checkboxes and then you can use your own script to "copy" the value elsewhere. Just add more values to the array if you need more keywords.
x = [
"accessible",
"air conditioning",
"dishwasher",
"garage",
];
$('div.whitelist-searchable-amenity input[type=checkbox]').each(function(){
if(x.indexOf(this.value) > -1)
{
alert("copy here");
}
});

HTML String in JSON

I know it isn’t the best idea to have html in your JSON but sadly I am not in control of this database or this website and am not given those privileges! I am making google maps markers and one of the values is corrupting the data and not being processed right. I know the issue is in the DESC value, is there some sort of character that isn’t escaped? Because almost all of the other objects in the JSON work just fine besides this one.
{"PHONE":"847-509-2000”,
"LAT":42.15223,
"STATE":"IL”,
"ZIP":60015.0,
"NAME":"DC Sarnies”,
"DESC":"Opening in early May 2011, D.C. Sarnies is a contemporary but casual restaurant
specializing in sandwiches and classic American food with a twist. As well as a
restaurant, we serve as a research and development kitchen for its parent company,
Highland Baking Company. Guest chefs and bakery clients will have the opportunity to try
out new products and let diners provide feedback on the dishes. The menu at D. C. Sarnies
has something for everyone with a wide variety of appetizers, soups, salads, entrees and
signature sandwiches and burgers to choose from. A full bar also gives diners a wide range
of craft beers including more than 25 on tap, wine and cocktails. For more information
visit us on Facebook at D.C. Sarnies or on Twitter DC_Sarnies.”,
"LONG":-87.84241,
"CITY":"Deerfield”,
"ADDR":"649 Lake Cook Road”,
"PHOTO":"DCcrabcakeburger.jpg”}]
jsonlint error message: Parse error on line 74:
...02, "DESC": "Opening in early Ma
----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
http://jsonlint.org/ use this website to validate your JSON.
The problem here are the closing quotes you use for strings, they're invalid.
End double quotes wrong. Rest everything is fine and working.
The double quotes at the end of the values are the problem. They're the wrong character.
There are a couple issues:
Different quotes used. ” is different from ".
Multi-line isn't escaped. If you need the line breaks, use \n. Otherwise, just have it one line
The extra ] at the end shouldn't be there
This is what you should have:
{
"PHONE": "847-509-2000",
"LAT": 42.15223,
"STATE": "IL",
"ZIP": 60015,
"NAME": "DC Sarnies",
"DESC": "Opening in early May 2011, D.C. Sarnies is a contemporary but casual restaurant specializing in sandwiches and classic American food with a twist. As well as a restaurant, we serve as a research and development kitchen for its parent company, Highland Baking Company. Guest chefs and bakery clients will have the opportunity to try out new products and let diners provide feedback on the dishes. The menu at D. C. Sarnies has something for everyone with a wide variety of appetizers, soups, salads, entrees and signature sandwiches and burgers to choose from. A full bar also gives diners a wide range of craft beers including more than 25 on tap, wine and cocktails. For more information visit us on Facebook at D.C. Sarnies or on Twitter DC_Sarnies.",
"LONG": -87.84241,
"CITY": "Deerfield",
"ADDR": "649 Lake Cook Road",
"PHOTO": "DCcrabcakeburger.jpg"
}