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
Highlighted
Regular Contributor
Posts: 253
Registered: ‎05-01-2016

Spatial Queries

[ Edited ]

With the hotfix for GeoSpatial Portal 2016, spatial queries for WMPS data sources are working!  How in the documentation can I find the accepted arguments for type: and operator: arguments to the filters: option of $GP.queries.add.  I am using type: "spatial" and operator: 0 which appears to give an intersection. I found these values in the examples.  I tried putting "Intersects" in quotes as in the examples but got an error message.  Are there othe spatial options like "overlaps" , "enclosed by", etc?

Also i am trying to find all features within a circular area around a point.  I get the point (x1,y1) from the user clicking on map.  I try giving the specification of the circle in this code

$GP.queries.add({
featureClassId: "Access Connection|Plants",
url: "http://rs4/myinstance/MapService.svc",
definitionName: "MapPublisher",
queryName: queryName,
applicationId: "myapp",
addToLegend: false,
filters:
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[x1, y1, 0, 0, 1],
[x1+1600, y1],
[x1, y1, 0, 0, 1]
]
],
"crsId": "EPSG:3857"
},
"properties": {}
});

but the resulting query treats the circle specification as if it was a line..  I am able to use this specification successfully for GP.map.draw (a circle is drawn)

 

  

 

Using the EPSG:3857 projection (i am displaying OpenStreet map as backdrop), measurements are off by about 10% - is that due to the projection?  (Something that measures 1 mile in GeoMedia measures .87 miles using the measurement tool in GeoSpatial Portal.  

 

 

 

 

Thanks very much for any advice,

Jane

Highlighted
Technical Evangelist
Posts: 1,275
Registered: ‎09-11-2015

Re: Spatial Queries

[ Edited ]

Hi Jane,

 

there's probably not much details on this configuration in the docs. But looking into the API.js file I can see several options for the filters:

    if (config.filters[i].type === "advanced") {
        analysisStub.firstWhereClause = config.filters[0].value;
        analysisStub.firstWhereAttributes = [];
    } else if (config.filters[i].type === "spatial") {
        var spatialFilter = config.filters[i] || {};
        analysisStub.spatialOperator = spatialFilter.operator;
        analysisStub.spatialOperatorNegation = !!spatialFilter.complement;
        analysisStub.geometry = getPortalObj(...;
        if (config.filters[i].operands[0].type === "BoundingBox")
            analysisStub.geometry.isBBox = true;
        if (gp.services.find(... === "WFS")
            analysisStub.geometry.swapCoordinates();
    } 

I'm afraid you will need to dig into this file to get some answers.

 

Also keep in mind that some properties apply only to WFS and some to WMPS. I don't know whether it's supported to pass circular spatial filter as this is not a valid GeoJSON geometry as pointed elsewhere in API doc.

 

Regarding the measurement - the difference between Portal and GeoMedia most likely is that in GeoMedia you can measure based on either projected measures or true measures. So yes, the coordinate system, mainly UTM projection (EPSG:3857) can have a great influence on the measuring outputs. See this interesting post (and nice app).

 

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial