Skip to content

Support ArcGIS Rest Services #3263

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

Merged
merged 1 commit into from
Mar 3, 2015
Merged

Support ArcGIS Rest Services #3263

merged 1 commit into from
Mar 3, 2015

Conversation

cwgrant
Copy link
Contributor

@cwgrant cwgrant commented Feb 21, 2015

This adds native support for ArcGIS Rest Layers to ol3. Both MapServer and ImageServer services are supported - the ArcGIS Rest API is documented at http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Export_Map/02r3000000v7000000/.

Implementation wise, this is supported by adding a data source, TileArcGISRest, which is similar to the existing WMS source. ArcGIS support is loosely based on the ArcGIS93Rest layer available in OpenLayers 2.13.1. Creating a tile layer using a TileArcGISRest is easy:

var layer = new ol.layer.Tile({
  source: new ol.source.TileArcGISRest({
    url: "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer",
  }),
  opacity: .5  
});

This feature is discussed in #654.

@ahocevar
Copy link
Member

Thanks for contributing this frequently demanded feature! I'll give it a thorough review tomorrow. In the meantime, if you haven't already, please submit a CLA.

@@ -4978,6 +4978,104 @@ olx.source.ServerVectorOptions.prototype.logo;
*/
olx.source.ServerVectorOptions.prototype.projection;

/**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* params: Object.<string,*>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is optional, so the type should be (Object.<string, *>|undefined)

@ahocevar
Copy link
Member

Great contribution, thanks @cwgrant! Please address my few minor comments. When done, it would be good to squash the commits into one, with something like

git pull --rebase upstream master
git rebase -i HEAD~8

When the text editor opens, replace pick for all but the first commit in the list with squash.

@tschaub
Copy link
Member

tschaub commented Feb 22, 2015

This looks like a great contribution. Thanks for the work on it @cwgrant.

Does this source work against cached layers? Not sure exactly the words to use, but I'm talking about resources advertised as a "single fused map cache."

What other source types can you imagine we might add for working against ArcGIS services? I'm thinking about the name for this source and wondering what sources we might want to reserve room for in the future. What might a vector source be named? And will there be a non-tiled raster source? Just wanting to make sure current names will make sense in the future.

@ahocevar
Copy link
Member

If the name ol.source.TileArcGISRest makes sense, the file should be named tilearcgisrestsource.js.

@cwgrant
Copy link
Contributor Author

cwgrant commented Feb 22, 2015

Thanks for the comments @ahocevar. I have addressed them and attempted to squash the commits together - please let me know if I messed it up.

@ahocevar
Copy link
Member

Looks like you forgot to git push --force your changes after squashing the commits. And I think you missed my comment about renaming the tilearcgissource.js file to tilearcgisrestsource.js.

You may also want to remove the stable annotation from the ol.source.TileArcGISRest constructor, so we can rename it later (cc @tschaub).

Other than that, it looks good now.

@tschaub
Copy link
Member

tschaub commented Feb 23, 2015

I wouldn't be opposed to a stable constructor right now. I just thought we should at least talk about what future sources might be added. And I'm not clear on how "single fused map caches" work with this.

@cwgrant
Copy link
Contributor Author

cwgrant commented Feb 23, 2015

@tschaub

Does this source work against cached layers? Not sure exactly the words to use, but I'm talking about resources advertised as a "single fused map cache."

This source does support cached layers, including single fused map cache, but its usage is not recommended for them since you won't be hitting the cached directly and lose the performance benefits of the cache. This source will grab the tiles from ArcGIS MapServer and ImageServer services by requested dynamic tiles. Both of these services can optionally be configured server side with a cache. The existing XYZ source can be used for cached services (see http://openlayers.org/en/v3.2.0/examples/xyz-esri.js). I added a comment to this affect in the TiledArcGISRest constructor.

What other source types can you imagine we might add for working against ArcGIS services? I'm thinking about the name for this source and wondering what sources we might want to reserve room for in the future. What might a vector source be named?

A vector source could grab data from an ArcGIS FeatureServer so Feature should be in its name. Adding that capability would likely be similar to WFS, so the source might still be a ServerVector utilizing a new format for ArcGIS feature data. I haven't used WFS on OL3, just OL2 so I may be mistaken there.

And will there be a non-tiled raster source?

Yes, that is a good idea. I hadn't realized that in OL3 the "singleTile" flag doesn't exist any more and there are separate sources for grid/non-grid requests. This would likely be similar to the ImageWMS/TileWMS naming convention, though "Image" = Single Tile seems is a little confusing to me.

Additionally, although XYZ does support cached ArcGIS layers, it's possible that a TileArcGISCache layer that extends XYZ could have some value in the future. I can't think of other non-tiled raster sources.

Based on this do you think the name TileArcGISRest is still appropriate? There are a lot of different possibilities with ESRI so it's hard to predict the future for naming! I'll update the stable constructor based on further discussion.

* tileGrid: (ol.tilegrid.TileGrid|undefined),
* maxZoom: (number|undefined),
* projection: ol.proj.ProjectionLike,
* serverType: (ol.source.wms.ServerType|string|undefined),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter is not used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will remove maxZoom and serverType.

Adding a data source to support ArcGIS Map Server and Image Server.
Functionality is similar to the ArcGIS93Rest Layer in OpenLayers 2.
var projWords = projection.getCode().split(':');
var srid = projWords[projWords.length - 1];

params.SIZE = tileSize + ',' + tileSize;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching these to string references into object so the closure compiler doesn't clobber them.

@ahocevar
Copy link
Member

Any more opinions on the name of this new source? Given #3263 (comment), I think the current name is appropriate.

@tschaub
Copy link
Member

tschaub commented Feb 25, 2015

Thanks for the additional detail @cwgrant. I agree it's a good name.

@fredj fredj added this to the v3.3.0 milestone Feb 25, 2015
ahocevar added a commit that referenced this pull request Mar 3, 2015
Support ArcGIS Rest Services
@ahocevar ahocevar merged commit d33a45d into openlayers:master Mar 3, 2015
@bartvde
Copy link
Member

bartvde commented Mar 4, 2015

thanks @cwgrant for this great contribution!

@bartvde
Copy link
Member

bartvde commented Mar 4, 2015

Anybody able to reproduce the issues reported here?

https://twitter.com/6artvde/status/573197927977525248

@bartvde
Copy link
Member

bartvde commented Mar 4, 2015

Seems there is a Retina issue here

This was referenced Mar 4, 2015
@shaunakv1
Copy link

@cwgrant , @ahocevar I am able to request ESRI's image services in tiles. However I would like to request the full image and render it, and not broken into tiles. So something on the lines of imageWMS instead of tileWMS.

Current Tiled Code:

 vm.imageryDisplayLayer = new ol.layer.Tile({
                source: new ol.source.TileArcGISRest({
                  url: feature.ImageService_Server + "/" + feature.ImageService_Service,
                  params: {
                    mosaicRule: JSON.stringify({
                      "mosaicMethod" : "esriMosaicNone",
                      "where" : feature.ImageService_Key + " = " +  feature.ImageService_Value
                    })
                  },
                }),
                opacity: .7
          })

Is there a way to request the full image from ArcGIS rest? I tried the static image layer, but it doesn't request new images on zoom. Tiled Grid for ArcGIS Rest api is not sufficient, because rendering rules we are using for the image services need to work on full image.

Any ideas?

Update

So looks like @llambanna tried to add this feature as ol.source.ImageArcGISRest layer in pull request #3847 and #3880. Seems like the exact feature I am looking for. Any ideas on what more it needs to get merged? I can work on anything more that is needed to get that accepted.

@llambanna
Copy link
Contributor

The only reason it wasn't merged was because I didn't jump through the
right github hoops, the code itself is 100% working and good, nothing wrong
with it. Just put it into a separate js file, reference and use.

On Fri, 25 Mar 2016, 5:57 a.m. Shaunak Vairagare, [email protected]
wrote:

@cwgrant https://github.com/cwgrant , @ahocevar
https://github.com/ahocevar I am able to request ESRI's image services
in tiles. However I would like to request the full image and render it, and
not broken into tiles. So something on the lines of imageWMS instead of
tileWMS.

Current Tiled Code:

vm.imageryDisplayLayer = new ol.layer.Tile({
source: new ol.source.TileArcGISRest({
url: feature.ImageService_Server + "/" + feature.ImageService_Service,
params: {
mosaicRule: JSON.stringify({
"mosaicMethod" : "esriMosaicNone",
"where" : feature.ImageService_Key + " = " + feature.ImageService_Value
})
},
}),
opacity: .7
})

Is there a way to request the full image from ArcGIS rest? I tried the
static image layer, but it doesn't request new images on zoom. Tiled Grid
for ArcGIS Rest api is not sufficient, because rendering rules we are using
for the image services need to work on full image.

Any ideas?

Update

So looks like @llambanna https://github.com/llambanna tried to add this
feature as ol.source.ImageArcGISRest layer in pull request #3847
#3847 and #3880
#3880. Seems like the exact
feature I am looking for. Any ideas on if that ever made it as a feature?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#3263 (comment)

@ahocevar
Copy link
Member

@llambanna any chance you could clean up the #3880 branch?

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

Successfully merging this pull request may close these issues.

7 participants