1

Im using following code to find projection of layer

from geoserver.catalog import Catalog 
cat=Catalog("http:// localhost:8080/geoserver/rest") 
myResource = cat.get_resources(store='storeName', workspace='workspaceName')
layers = cat.get_layers(myResource)
for layer in layers:
    layer.projection

I found that few layers are having projection "None". How can I update those layers projection with "EPSG:4326" using gs config.

2
  • Can you guarantee that all the data is in EPSG:4326? Dec 19, 2014 at 2:40
  • yes..all of layers had "EPSG:4326" Dec 22, 2014 at 6:35

2 Answers 2

1

I think you just need to set the srs property of the layer

layer.srs = "EPSG:4326"
layer.native_crs = "EPSG:4326"
1
  • Thanks for information. I have tried as above and saved as follow cat.save(layer) but it's not saving the layer.what can I do next? Dec 22, 2014 at 4:58
0

You actually need to change this on the resource level:

layer=cat.get_layer("layer_name")
resource=layer.resource
resource.projection='EPSG:4326'
cat.save(resource)
cat.save(layer)
cat.reload()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.