Exemple #1
0
 def creator():
     try:
         res = capakey_gateway_request(self.client,
                                       'GetAdmGemeenteByNiscode', id)
     except GatewayRuntimeException:
         raise GatewayResourceNotFoundException()
     return Gemeente(
         res.Niscode, res.AdmGemeentenaam, (res.CenterX, res.CenterY),
         (res.MinimumX, res.MinimumY, res.MaximumX, res.MaximumY))
Exemple #2
0
 def creator():
     try:
         res = capakey_gateway_request(
             self.client, 'GetKadPerceelsnummerByKadPerceelsnummer',
             sectie.afdeling.id, sectie.id, id)
     except GatewayRuntimeException:
         raise GatewayResourceNotFoundException()
     return Perceel(
         res.KadPerceelsnummer, sectie, res.CaPaKey, res.PERCID,
         res.CaPaTy, res.CaShKey, (res.CenterX, res.CenterY),
         (res.MinimumX, res.MinimumY, res.MaximumX, res.MaximumY))
Exemple #3
0
 def creator():
     try:
         res = capakey_gateway_request(self.client,
                                       'GetKadPerceelsnummerByPERCID',
                                       percid)
     except GatewayRuntimeException:
         raise GatewayResourceNotFoundException()
     return Perceel(
         res.KadPerceelsnummer,
         Sectie(res.KadSectiecode,
                Afdeling(res.KadAfdelingcode)), res.CaPaKey, res.PERCID,
         res.CaPaTy, res.CaShKey, (res.CenterX, res.CenterY),
         (res.MinimumX, res.MinimumY, res.MaximumX, res.MaximumY))
Exemple #4
0
 def creator():
     try:
         res = capakey_gateway_request(self.client,
                                       'GetKadSectieByKadSectiecode',
                                       aid, id)
     except GatewayRuntimeException:
         raise GatewayResourceNotFoundException()
     return Sectie(
         res.KadSectiecode,
         afdeling,
         (res.CenterX, res.CenterY),
         (res.MinimumX, res.MinimumY, res.MaximumX, res.MaximumY),
     )
Exemple #5
0
 def creator():
     try:
         res = capakey_gateway_request(
             self.client, 'GetKadAfdelingByKadAfdelingcode', id)
     except GatewayRuntimeException:
         raise GatewayResourceNotFoundException()
     return Afdeling(id=res.KadAfdelingcode,
                     naam=res.KadAfdelingnaam,
                     gemeente=Gemeente(res.Niscode,
                                       res.AdmGemeentenaam),
                     centroid=(res.CenterX, res.CenterY),
                     bounding_box=(res.MinimumX, res.MinimumY,
                                   res.MaximumX, res.MaximumY))
Exemple #6
0
def capakey_rest_gateway_request(url, headers={}, params={}):
    try:
        res = requests.get(url, headers=headers, params=params)
        res.raise_for_status()
        return res
    except requests.ConnectionError as ce:
        raise GatewayRuntimeException(
            'Could not execute request due to connection problems:\n%s' %
            repr(ce), ce)
    except requests.HTTPError as he:
        raise GatewayResourceNotFoundException()
    except requests.RequestException as re:
        raise GatewayRuntimeException(
            'Could not execute request due to:\n%s' % repr(re), re)