I want to calculate protected areas in a region. My procedure was to convert the WDPA data set into an image and then calculate the area using the reducer.sum function. My problem is that my pixel value from Germany_PA is: constant: 0, so I could not use the reducer.sum function.
Is there a way to change the pixelvalue or is there another function to calculate the area?
Here is my code:
Map.setCenter(11.57, 50.88, 5);
var dataset = ee.FeatureCollection('WCMC/WDPA/current/polygons');
// WDPA Polygone filter
var target_values = ee.Filter.inList('DESIG', [ 'Nationalpark' ]);
var Nationalpark = dataset.filter(ee.Filter.and(
(target_values),
ee.Filter.eq('MARINE', '0')))
var gaul = ee.FeatureCollection("FAO/GAUL_SIMPLIFIED_500m/2015/level1")
var Germany = gaul.filter(
ee.Filter.eq('ADM0_NAME', 'Germany'))
var PA = ee.Image().float().paint(Nationalpark)
// Nationalpark in Germany
var Germany_PA = PA.clip(Germany)
Map.addLayer(Germany_PA,{palette: ['00FF00']} , 'Germany_PA')