Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for FeatureInfo on on Map Source type="ags" layers #747

Closed
tchaddad opened this issue Sep 18, 2022 · 7 comments
Closed

Add support for FeatureInfo on on Map Source type="ags" layers #747

tchaddad opened this issue Sep 18, 2022 · 7 comments
Milestone

Comments

@tchaddad
Copy link
Collaborator

Map Source type="ags" is a common service type that can support queries, but GM does not currently support the query option on this type of service

According to previous discussion on #730 this is a known missing support, but may be an easy addition. The service type is quite common, and so adding this support would be super helpful.

@tchaddad
Copy link
Collaborator Author

tchaddad commented Sep 18, 2022

A sample service of "ags-polygons" is used in the demo mapbook-test-servers.xml mapbook:
https://gis2.co.dakota.mn.us/arcgis/rest/services/DCGIS_OL_Transportation/MapServer/21

You can find the map source block config for this service by searching for <map-source name="ags-polygons" type="ags"> in the test-servers mapbook:

https://github.com/geomoose/gm3/blob/main/examples/desktop/mapbook-test-servers.xml

@brentfraser
Copy link
Contributor

Would be nice. For those interested try to do an identify on the airstrip polygon in the center of this map:
https://demo.geomoose.org/3.x/desktop/?mapbook=test#on=ags-polygons/runways;openstreetmap/osm_mapnik&loc=4.9003;-10377960.57;5562838.67

@theduckylittle theduckylittle added this to the 4.0.0 milestone Sep 25, 2022
@brentfraser
Copy link
Contributor

brentfraser commented Dec 14, 2022

A note on the "ags" protocol (so when I revisit this next year I won't need to re-research this).

ESRI does allow an Identify on the ags raster service. Instead of doing a /Mapserver/export, you do a /Mapserver/identify. See Example 3 at https://developers.arcgis.com/rest/services-reference/enterprise/identify-map-service-.htm The specific layer ("2") is selected by the parameter &layers=all:2 (to display a layer we currently use <param name="layers" value="show:2" />). The request also requires tolerance, mapExtent, and imageDisplay (e.g. size). We'd likely have to write a specific method to construct and execute this query.

As an alternative to the above ESRI Identify method, I tried our "query-as" route because ESRI does allow a query request like /MapServer/21/query. I made a couple of minor code changes to enable queries on a mapsource type of 'ags':

diff --git a/src/gm3/actions/mapSource.js b/src/gm3/actions/mapSource.js
index 8c4a05b..85d17c9 100644
--- a/src/gm3/actions/mapSource.js
+++ b/src/gm3/actions/mapSource.js
@@ -517,6 +517,7 @@ function isQueryable(mapSource) {
     }
     // check by type
     switch(mapSource.type) {
+        case 'ags':
         case 'wms':
         case 'wfs':
         case 'ags-vector':

diff --git a/src/gm3/actions/query.js b/src/gm3/actions/query.js
index e00bee3..7b411e4 100644
--- a/src/gm3/actions/query.js
+++ b/src/gm3/actions/query.js
@@ -57,6 +57,7 @@ export const runQuery = createAsyncThunk('query/run', (arg, {getState, dispatch}
                 return wmsGetFeatureInfoQuery(layer, state.map, mapSource, queryDef);
             case 'wfs':
                 return wfsGetFeatureQuery(layer, state.map, mapSource, queryDef);
+            case 'ags':
             case 'ags-vector':
                 return agsFeatureQuery(layer, state.map, mapSource, queryDef);
             case 'geojson':

I then added a layer for querying and referenced it in the layer for display:

    <!-- - - - - - - -  TYPE = "ags"   - - - - - - - - - -->
    <map-source name="ags-polygons"           type="ags">
        <url>https://gis2.co.dakota.mn.us/arcgis/rest/services/DCGIS_OL_Transportation/MapServer/export</url>
        <param name="cross-origin" value="anonymous"/>
        <layer name="runways" title="Runways" query-as="ags-polygons-query/runways">
            <param name="layers" value="show:21" />
        </layer>
    </map-source>

    <map-source name="ags-polygons-query"           type="ags">
        <url>https://gis2.co.dakota.mn.us/arcgis/rest/services/DCGIS_OL_Transportation/MapServer/21</url>
        <config name="pixel-tolerance" value="2" />
        <param name="cross-origin" value="anonymous"/>
        <layer name="runways" >
            <template name="identify" auto="true" />
        </layer>
    </map-source>

Note the slightly different URLs.

It seems to work fine:
image

I'm not sure I like the use of query-as method over writing a separate function in GeoMoose. I have yet to test the Select and Search operations with this method...

@brentfraser
Copy link
Contributor

For symmetry, I removed the change to query.js and now have:

<map-source name="ags-polygons"           type="ags">
:

<map-source name="ags-polygons-query" type="ags-vector">
:

And I've tested the Select and Search functions and they seem to work.

@tchaddad
Copy link
Collaborator Author

This is exciting @brentfraser! I haven't yet had a chance to try it locally, but glad it doesn't look too complicated to add. I see a ton of these services in the wild, and enabling query is a really nice option...

@brentfraser
Copy link
Contributor

Test with #775

@klassenjs klassenjs modified the milestones: 4.0.0, 3.11.0 Feb 17, 2023
@tchaddad
Copy link
Collaborator Author

Working in 3.12!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants