PHP code example of nieuwland / ogc-serializer

1. Go to this page and download the library: Download nieuwland/ogc-serializer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nieuwland / ogc-serializer example snippets




use Nieuwland\OgcSerializer\SerializerFactory;
use Nieuwland\OgcSerializer\Type\WMS\Capabilities\Capabilities130;

$serializer   = SerializerFactory::create();
/** @var Capabilities130 $capabilities */
$capabilities = $serializer->deserialize($xml, Capabilities130::class, 'xml');
$layer = $capabilities->getLayer('mylayer');



use Nieuwland\OgcSerializer\Generic\ServiceCapabilitiesFactory;
use Nieuwland\OgcSerializer\SerializerFactory;

$serializer   = SerializerFactory::create();
/** @var Capabilities130 $capabilities */
$capabilities = $serializer->deserialize($xml, Capabilities130::class, 'xml');
$genericCapabilities = ServiceCapabilitiesFactory::create($capabilities);
$genericCapabilities->getLayerNames();




use Nieuwland\OgcSerializer\Utils\WfsSchemaElement;

$reader = new WfsSchemaReader()
$fields = $reader->extractFields($xml, 'bestuurlijkegrenzen:gemeenten');
foreach ($fields as $field) {
    echo $field->getName() . $field->getType();
}