I am using geoscript to reproject a layer in my geoserver.

I can use geoserver/catalog to access a layer's projection with no issue.

However, I can't change it. My code is like this:

var catalog = require("geoserver/catalog");
var Process = require("geoscript/process").Process;
var Layer = require("geoscript/layer").Layer;
var Projection = require("geoscript/proj").Projection;

exports.process = new Process({
  inputs: {
    sentence: {
      type: "String"
  outputs: {
    old: {
      type: "String"
    neo: {
      type: "String"
    temp: {
      type: "Boolean"
  run: function() {
    var namespace = catalog.namespaces[0].alias;
    var myPrj = Projection("EPSG:2008");
    var myLayer = catalog.getVectorLayer("test:counties");
    //catalog.getVectorLayer("test:counties").projection = myPrj;
    return {
      old: myLayer.projection,
      neo: myPrj,
      temp: myLayer.temporary

The code I commented line never works however wps doesn't tell me any error.

Do you know how can I fix this?


Looking at this page seems to indicate that you can't just change the value of the projection attribute to reproject a layer.

Try something like:

js> // transform the boundary to EPSG:4326
js> boundary.projection = "epsg:2877";
js> boundary = boundary.transform("epsg:4326");
<Polygon [[[-104.85448745942264, 39.660159265877176], [-104.854236940...>
  • Thank you iant! This is exactly what I am looking for. I used this method and got geojson of the geometries. However, I also need attributes of the geometries. Do you know any other geoscript module attach attributes to geometries? – zhangjinzhou May 22 '17 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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