Abstract Photovoltaic (PV) estimation in an urban environment requires detection of rooftop area, design of PV system based on optimization on PV placement distance and the study of additional benefit of lower cooling load of building by shading provided by PV panels. The study is aimed at policymakers to introduce renewable energy policy toward net-zero energy buildings in urban areas. In this research, the capital city of Pakistan, Islamabad, is analyzed for rooftop PV capabilities using deep learning algorithms. The area of the rooftop is calculated by extracting buildings in high-resolution satellite imagery using a deep learning algorithm. The site location is analyzed for available solar energy resources. The distance between the rooftop-PV array is optimized based on self-shading losses, coefficient of performance, energy yield, net-zero energy analysis, and reduction of cooling load of the building provided by PV arrays as shading devices. The 40-km2 area of Islamabad considered in this research can generate 1038 GWh of solar energy annually from its 4.3-km2 rooftop area by installed capacity of 447 MW PV panels rows placed at 0.75 m apart. The electricity generated by Islamabad can curtail residential load from the national grid and form a near net-zero energy zone while the electrical energy from the grid can be provided to the industries to enhance the economy and reduce unemployment in Pakistan.