koopjs / FeatureServer

An open source Geoservices Implementation (deprecated)
https://geoservices.github.io
Other
101 stars 32 forks source link

Errors with SpatialAnalysisTools #147

Closed LuisRguezEsriSpain closed 5 years ago

LuisRguezEsriSpain commented 5 years ago

I have developed a koop point feature server with FeatureServer version 2.15.1.

On a ArcGIS OnLine organization I have created a WebMap that includes the koop point Feature Server. The Feature Server is displayed on the WebMap properly.

Then I run the FindHotSpots SpatialAnalysisTools tool and get this error:

<Msg time='2019-03-13T08:44:28,6' type='SEVERE' code='20010' target='System/SpatialAnalysisTools.GPServer' methodName='GPServerSync.CheckMessages' machine='172.50.0.206' process='6476' thread='7524' user='admin' >Error executing tool. FindHotSpots Job ID: jf7545d9de98746b3b01c7620c0f891dc : Invalid value for parameter analysisLayer - Details : Invalid JSON for GPFeatureRecordSetLayer or GPRecordSet datatype </Msg>

Any idea about the error?

Regards,

Luis

rgwozdz commented 5 years ago

@LuisRguezEsriSpain - can you use DevTools to identify the request to the Koop server that leads to this error? If so, please share.

rgwozdz commented 5 years ago

Even better if you could share your web map. I can't reproduce on my Koop test servers.

LuisRguezEsriSpain commented 5 years ago

I attach a screenshot of FindHotSpots request that I can see on DevTool.

FindHotSpots_Request

rgwozdz commented 5 years ago

I looked at the JSON coming back from /crossdata/FeatureServer/3/query. One thing I notice is that longitud and latitud are empty objects and the fields array identifies them as strings. I think ArcGIS doesn't always play well with nested objects in properties. You may want to remove longitud and latitud from properties if they are always empty. Or convert to a non-object type.

LuisRguezEsriSpain commented 5 years ago

I have removed longitud and latitud from properties, but the issue persists.

rgwozdz commented 5 years ago

Ah, okay, I see the issue. For analysis tools to work, you must use the Koop URLs that include the rest/services fragment. Note that your Koop instances establishes two layer routes:

/crossdata/FeatureServer/:id and /crossdata/rest/services/FeatureServer/:id

The handler for these routes are identical. But ArcGIS clients often require the second URL because they expect rest/service to be in the URL. I expect you will find the hot spot analysis to work if you create your item with /crossdata/rest/services/FeatureServer/3.

In the future, I expect Koop will only generate routes with rest/services but for now these older routes are maintain for backward compatibility.

LuisRguezEsriSpain commented 5 years ago

When I try to add a item on my AGOL ornanization by using the URL https://38df714d.ngrok.io/crossdata/rest/services/FeatureServer/3 , I get this error.

ErrorAddItem

After adding https://38df714d.ngrok.io/crossdata/rest/services/FeatureServer/3 on the Web Map, I run hot spot analysis and I get the same error "Invalid value for parameter analysisLayer - Details : Invalid JSON for GPFeatureRecordSetLayer or GPRecordSet datatype"

rgwozdz commented 5 years ago

I'm not able to reproduce, with the latest Koop and FeatureServer, this works for me, and I have reproduced a service using your data.

Are you able to update your Koop and FeatureServer versions to the latest versions? 3.10.1 and 2.16.4

LuisRguezEsriSpain commented 5 years ago

I've already solved the issue.

SpatialAnalysisTools tools need "rest/service" in analysis layer URL, as you told me. That's why I've changued the the provider name to 'arcgis/rest/services/crossdata' value.

I've run the hot spot analysis using this analysis layer URL .../arcgis/rest/services/crossdata/FeatureServer/3 and the analysis works.

Thank you for your help.

rgwozdz commented 5 years ago

Ok, just to be clear for anyone reading this thread; the latest versions of koop and koop-output-geoservices don't require you to add rest/services to your provider name. It create routes with rest/services in the path by default.