Surabaya is the capital of the Indonesian province of East Java and the second-largest city in Indonesia after Jakarta. Located on the northeastern border of Java island, on the Madura Strait, it is one of the earliest port cities in Southeast Asia. According to the National Development Planning Agency, Surabaya is one of the four main central cities of Indonesia, alongside Jakarta, Medan, and Makassar. The city has a population of 2.89 million within its city limits in 2019 and 9.5 million in the extended Surabaya metropolitan area, making it the second-largest metropolitan area in Indonesia. The city was settled in the 10th century by the Kingdom of Janggala, one of the two Javanese kingdoms that were formed in 1045 when Airlangga abdicated his throne in favor of his two sons. In the late 15th and 16th centuries, Surabaya grew to be a duchy, a major political and military power as well as a port in eastern Java, probably under the Majapahit empire. At that time, Surabaya was already a major trading port, owing to its location on the River Brantas delta and the trade route between Malacca and the Spice Islands via the Java Sea. During the decline of Majapahit, the lord of Surabaya resisted the rise of the Demak Sultanate and only submitted to its rule in 1530. Surabaya became independent after the death of Sultan Trenggana of Demak in 1546. From the 18th century until the mid-20th century, Surabaya was the largest city in the Dutch East Indies, and the center of trading in the Indonesian archipelago, which was then a competitor to Shanghai and Hong Kong. The city is known as Kota Pahlawan (the city of heroes) due to the importance of the Battle of Surabaya during the Indonesian National Revolution. The city is one of the important financial, commercial, industrial, transportation, and entertainment hub of the archipelago, arguably second only to Jakarta, and the Port of Tanjung Perak is Indonesia's second-busiest seaport located on northern Surabaya. The city is also known for being one of the cleanest and greenest in Indonesia.