geoadmin / mf-chsdi3

api3.geo.admin.ch source code
https://api3.geo.admin.ch
Other
33 stars 15 forks source link

Remove unwanted config3d and add DB constraint on config3d column #2170

Closed loicgasser closed 8 years ago

loicgasser commented 8 years ago

2 layers don't work in 3d because of a configuration mistake (config3d: " ") see:

ch.bafu.gewaesserschutz-biologischer_zustand_diatomeen: {
wmsUrl: "https://wms.geo.admin.ch/?REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.0.0",
wmsLayers: "ch.bafu.gewaesserschutz-biologischer_zustand_diatomeen",
attribution: "OFEV",
background: false,
searchable: false,
format: "png",
serverLayerName: "ch.bafu.gewaesserschutz-biologischer_zustand_diatomeen",
attributionUrl: "http://www.bafu.admin.ch/index.html?lang=fr",
timeBehaviour: "all",
tooltip: true,
label: "Diatomées",
singleTile: true,
highlightable: true,
chargeable: false,
timestamps: [
"2013",
"2012",
"2011"
],
topics: "api,bafu,ech,gewiss,inspire,wms-bgdi_prod",
hasLegend: true,
config3d: " ",
type: "wms",
timeEnabled: true
}

and

ch.swisstopo.images-spot-5.metadata: {
wmsUrl: "https://wms.geo.admin.ch/?REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.0.0",
opacity: 0.75,
attribution: "swisstopo",
shop: [
"district",
"canton",
"rectangle",
"whole"
],
searchable: false,
format: "png",
attributionUrl: "https://www.swisstopo.admin.ch/fr/home.html",
serverLayerName: "ch.swisstopo.images-spot-5.metadata",
background: false,
timeBehaviour: "last",
tooltip: true,
label: "Spot Mosaic étendue",
wmsLayers: "ch.swisstopo.images-spot-5.metadata",
singleTile: true,
highlightable: false,
chargeable: false,
topics: "api,ech,inspire,swisstopo,wms-bgdi_prod",
hasLegend: false,
config3d: " ",
type: "wms",
timeEnabled: false
}

and try

We should make sure that all the config 3d keys start with ch. if we want to avoid this kind of errors.

You can also try: Test Link

ltclm commented 8 years ago

i have fixed the data in bod_master and added a constraint in the database to the column and some other columns too:

update re3.layers_js SET fk_config3d = NULL WHERE pk_layer in ('ch.bafu.gewaesserschutz-biologischer_zustand_diatomeen','ch.swisstopo.images-spot-5.metadata');

ALTER TABLE re3.layers_js
  ADD CONSTRAINT fk_config3d_carriage_return CHECK ( fk_config3d ~* '^[a-z0-9\.\-_]+$' )  ;

ALTER TABLE re3.layers_js
  ADD CONSTRAINT pk_layer_carriage_return CHECK ( pk_layer ~* '^[a-z0-9\.\-_]+$' )  ;

ALTER TABLE re3.layers_js
  ADD CONSTRAINT fk_id_dataset_carriage_return CHECK ( fk_id_dataset ~* '^[a-z0-9\.\-_]+$' )  ;  
loicgasser commented 8 years ago

You rule ! And you are super reactive. Thanks

gjn commented 8 years ago

+1. Will be fixed on next deploy.