Check the API docs
https://renewmap.readme.io/reference/get-project-locations-shpfile
You will need an API key to get started.
Check the Getting Started page for instructions.
Save and run this script in any Python environment to get the latest RenewMap Projects data as an Esri shapefile.
- Save the script below as a Python file, eg
get_renewmap_projects_shp.py
- Run the script in ArcGIS Pro:
- Open your project
- Open a Python window (
Alt + Shift + p
) - Paste and run the script
- A zipped folder containing the shapefile will save in your project working directory
- Alternatively, you can run the script in your favourite IDE, such as VSCode, or in a PowerShell or Bash terminal.
- Re-run the script to get the latest data.
import requests, zipfile, io
from dataclasses import dataclass
from typing import Dict
API_KEY = "YOUR_API_KEY" # Replace with your actual API key
URL = "https://api.renewmap.com.au/api/v1/files/esri/shp/projects.zip"
SAVE_PATH = "projects.zip"
@dataclass
class APIConfig:
"""Configuration class for API parameters.
Attributes:
base_url: Base URL for the API endpoint
headers: HTTP headers for API requests
"""
base_url: str = URL
headers: Dict = None
def __post_init__(self):
"""Initialize default headers if none provided"""
if self.headers is None:
self.headers = {
"accept": "application/json",
"Authorization": f"Bearer {API_KEY}"
}
def fetch_shapefile(config: APIConfig, save_path: str) -> None:
"""Fetch shapefile data from API and save to disk.
Args:
config: APIConfig object containing API configuration
save_path: Path to save the downloaded shapefile
"""
response = requests.get(config.base_url, headers=config.headers)
print(response.status_code)
if response.status_code == 200:
print("Data retrieved successfully:")
z = zipfile.ZipFile(io.BytesIO(response.content))
z.extractall(save_path)
print("💾 Shapefile saved to:", save_path)
else:
# Handle the error based on the status code
print("Error:", response.status_code)
config = APIConfig()
fetch_shapefile(config, SAVE_PATH)