ESRI & ArcGIS

You can easily use the RenewMap API to fetch RenewMap data in Esri shapefiles.

API Access

You will need an API key to get started.

The RenewMap API allows you to integrate up-to-date project data with data analysis platforms such as QGIS. By calling the API directly (rather than using a CSV export), you are guaranteed to always have the most up-to-date data in your GIS tools.

Setup

Save and run the following scripts in any Python environment to get the latest RenewMap Projects data as an Esri shapefile.

  1. Save the script below as a Python file, eg get_renewmap_projects_shp.py
  2. Run the script in ArcGIS Pro:
  3. Open your project
  4. Open a Python window (Alt + Shift + p)
  5. Paste and run the script
  6. A zipped folder containing the shapefile will save in your project working directory
  7. Alternatively, you can run the script in your favourite IDE, such as VSCode, or in a PowerShell or Bash terminal.
  8. Re-run the script to get the latest data.

Projects

import requests, zipfile, io
from typing import Dict
import os

API_KEY = "YOUR_API_KEY" # Replace with your actual API key
BASE_URL = "https://api.renewmap.com.au/api/v1/files/esri/shp/projects.zip"
SAVE_PATH = "projects"  # Directory to extract to, without .zip extension

headers = {
    "Authorization": f"Bearer {API_KEY}"
}

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 = BASE_URL
    headers: Dict = headers
    save_path: str = SAVE_PATH

    def get_url(self):
        return self.base_url

def fetch_shapefile(config: APIConfig) -> None:
    """Fetch shapefile data from API and save to disk.

    Args:
        config: APIConfig object containing API configuration

    """
    url = config.get_url()
    response = requests.get(url, headers=config.headers)

    print(f"Fetching: {url}")
    print(f"Status code: {response.status_code}")

    if response.status_code == 200:
        print("Data retrieved successfully")
        # Create directory if it doesn't exist
        os.makedirs(config.save_path, exist_ok=True)
        # Extract the zip file
        z = zipfile.ZipFile(io.BytesIO(response.content))
        z.extractall(config.save_path)
        print("Shapefile saved to:", config.save_path)

        # Check for .shp files and print their paths
        shp_files = [f for f in os.listdir(config.save_path) if f.endswith('.shp')]
        if shp_files:
            print("\nFound shapefiles:")
            for shp_file in shp_files:
                shp_path = os.path.join(config.save_path, shp_file)
                print(f"- {os.path.abspath(shp_path)}")
        else:
            print("Warning: No .shp files found in the extracted contents")
    else:
        print("Error:", response.status_code)

config = APIConfig()
fetch_shapefile(config)

Adding the fields extension

ℹ️ The projects endpoint includes a parameter to return a larger selection of project attributes. To enable, Set ADD_FIELDS = True at the top of the script above.

N.B. This data is returned in json format and needs to be unpacked in the script. The logic to unpack and reshape the fields data can be found in flatten_fields().

Network

import requests, zipfile, io
from typing import Dict
import os

API_KEY = "YOUR_API_KEY" # Replace with your actual API key
BASE_URL = "https://api.renewmap.com.au/api/v1/files/esri/shp/network.zip"
SAVE_PATH = "network"  # Directory to extract to

headers = {
    "Authorization": f"Bearer {API_KEY}"
}

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 = BASE_URL
    headers: Dict = headers
    save_path: str = SAVE_PATH

    def get_url(self):
        return self.base_url

def fetch_shapefile(config: APIConfig) -> None:
    """Fetch shapefile data from API and save to disk.

    Args:
        config: APIConfig object containing API configuration

    """
    url = config.get_url()
    response = requests.get(url, headers=config.headers)

    print(f"Fetching: {url}")
    print(f"Status code: {response.status_code}")

    if response.status_code == 200:
        print("Data retrieved successfully")
        # Create directory if it doesn't exist
        os.makedirs(config.save_path, exist_ok=True)
        # Extract the zip file
        z = zipfile.ZipFile(io.BytesIO(response.content))
        z.extractall(config.save_path)
        print("Shapefile saved to:", config.save_path)

        # Check for .shp files and print their paths
        shp_files = [f for f in os.listdir(config.save_path) if f.endswith('.shp')]
        if shp_files:
            print("\nFound shapefiles:")
            for shp_file in shp_files:
                shp_path = os.path.join(config.save_path, shp_file)
                print(f"- {os.path.abspath(shp_path)}")
        else:
            print("Warning: No .shp files found in the extracted contents")
    else:
        print("Error:", response.status_code)

config = APIConfig()
fetch_shapefile(config)

Turbines

import requests, zipfile, io
from typing import Dict
import os

API_KEY = "YOUR_API_KEY" # Replace with your actual API key
BASE_URL = "https://api.renewmap.com.au/api/v1/files/esri/shp/turbines.zip"
SAVE_PATH = "turbines"  # Directory to extract to

headers = {
    "Authorization": f"Bearer {API_KEY}"
}

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 = BASE_URL
    headers: Dict = headers
    save_path: str = SAVE_PATH

    def get_url(self):
        return self.base_url

def fetch_shapefile(config: APIConfig) -> None:
    """Fetch shapefile data from API and save to disk.

    Args:
        config: APIConfig object containing API configuration

    """
    url = config.get_url()
    response = requests.get(url, headers=config.headers)

    print(f"Fetching: {url}")
    print(f"Status code: {response.status_code}")

    if response.status_code == 200:
        print("Data retrieved successfully")
        # Create directory if it doesn't exist
        os.makedirs(config.save_path, exist_ok=True)
        # Extract the zip file
        z = zipfile.ZipFile(io.BytesIO(response.content))
        z.extractall(config.save_path)
        print("Shapefile saved to:", config.save_path)

        # Check for .shp files and print their paths
        shp_files = [f for f in os.listdir(config.save_path) if f.endswith('.shp')]
        if shp_files:
            print("\nFound shapefiles:")
            for shp_file in shp_files:
                shp_path = os.path.join(config.save_path, shp_file)
                print(f"- {os.path.abspath(shp_path)}")
        else:
            print("Warning: No .shp files found in the extracted contents")
    else:
        print("Error:", response.status_code)

config = APIConfig()
fetch_shapefile(config)

Troubleshooting

❓ Check the Troubleshooting guide for some solutions to common problems.