Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Contributor
Posts: 44
Registered: ‎10-27-2015
Accepted Solution

How can I draw a line and save it to a PSS in Geospatial Portal?

[ Edited ]

Hello everyone,

 

 I have a PSS storage service called "PSS". It  has a compound feature class called "Shapes".

Below is how I try to prompt user to draw a line which must me saved in the PSS storage.

 

.add({
    categoryIndex: 0,
    xtype: "tbbutton",
    iconCls : "myimagebutton",
    handler: function (b) {
     $GP.map.draw({
       "type": "LineString"
   },
   function (r) {
    $GP.edit.PSS.find({
     name: "PSS"
    },
    function(r2){
     $GP.edit.features.add({
      mapServiceId: r2.mapServiceId,
      featureClassId: "Shapes",
      geojson: r.feature.get_geoJSON()
     });
    });
   });
        }
 })

 

I always get "Maximum call stack size exceeded"! Any suggestions? Is it not possible?

 

Thank you

Denis

Highlighted
Contributor
Posts: 44
Registered: ‎10-27-2015

Re: How can I draw a line and save it to a PSS in Geospatial Portal?

Too many nested function. Splitting the function as shown below helps.

 

.add({
    categoryIndex: 0,
    xtype: "tbbutton",
    iconCls : "myimagebutton",
    handler: function (b) {
     $GP.map.draw({
       "type": "LineString"
   },
   function (r) {
    saveFeatures(r); 
   });
        }
 });

 

function saveFeatures(r){
 $GP.edit.PSS.find({
  name: "PSS"
 },
 function(r2){
  $GP.edit.features.add({
   mapServiceId: r2.mapServiceId,
   featureClassId: "Shapes",
   geojson: r.feature.get_geoJSON()
  },
  function (result) {
   $GP.map.draw.clear();
  });
 });
}

 

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.