Closed zstadler closed 5 years ago
@jgravois do you have any insight you can share on this? We're migrating from Leaflet to Openlayers and would like to avoid implementing stuff that were already implemented.
@HarelM i don't know of any projects to simplify working with Esri services in OpenLayers.
Also need to see if the following map server can be supported - seems like it does support tiles... https://geomolg.ps:6443/arcgis/rest/services/Orthophoto_WestBank_Aerial_2018_10cm_ITM_jpg_02/MapServer/
you can find a couple examples of a Leaflet map that displays a custom CRS to load Esri services in projections other than web mercator here:
Currently the only code I'm using for ESRI layers is to add tiles/{z}/{y}/{x}
which is extremely naive. The above example from the site's facebook group doesn't work with this suffix. It did work however with leaflet-esri without any non-mercator projection stuff...
I'm not sure how to proceed here as I don't even know where to start in order to support any of this in OpenLayers... :-(
Alternatively, if we assume the site supports EPSG:3857
it would be possible to use the export
API directly and get the image for the canvas or tile by providing the appropriate bounding box and size:
<base url>//export?bbox=<bbox>&size=<width>,<height>&dpi=96&transparent=true&bboxSR=3857&imageSR=3857&f=image
More information is available at ArcGIS REST API - EXPORT MAP
Another direction for exploring is
https://openlayers.org/en/latest/apidoc/module-ol_source_ImageArcGISRest-ImageArcGISRest.html
An example is available a
https://openlayers.org/en/latest/examples/arcgis-image.html
Its description says:
This example shows how to use a dynamic ArcGIS REST MapService. This source type supports Map and Image Services. For dyamic ArcGIS services.
I've created an example where OpenLayers shows two ESRI MapServices: Orthophoto base map and a Geology overlay.
In the above example, the base map is an ImageLayer and the overlay is a TileLayer. TileLayers have better performance and would be preferred.
Feature Services are not supported. IMO, they are low priority.
I don't see the overlay, am I missing something? Also how can I determine from URL that the user provides which type to use - image or tile?
you should only use image if tiles either
@jgravois Thanks for the info, but how I can know that given the user only sets a URL?
by using the url to fetch additional metadata for the service.
http://gis.shual.org.il/arcgis/rest/services/MAPS/Orto2015v1/MapServer?f=json
related: https://github.com/Esri/esri-leaflet/issues/1104#issuecomment-401880031
@jgravois thanks again!!
To reduce complexity and maintenance what is planned for this feature is to use TileArcGISRest
source without all the capabilities such as features server or different CRS.
If we decide in the future that the extra capabilities have value for our users and that it's worth the effort we will open a separate issue.
For the record, this also fixed the bug reported in #795
Feature
This issue aims at collecting the information for the potential support of ESRI layers under OpenLayers. In particular, ESRI server URLs that do not use the
{x}
,{y}
, and{z}
parameters.ESRI Map Server
Use the
export
API to retrieve raster data with the following steps:Check the server capabilities: GET
<baseurl>/?f=json
where<baseurl>
is the user-provided map address.Send an export request: GET
<baseurl>/export?bbox=<bbox>&size=<width>,<height>&dpi=96&format=<format>&transparent=true&bboxSR=3857&imageSR=3857&f=json
where<bbox>
is the bounding box of the map in EPSG 3857 coordinates<width>
and<height>
are taken from the map size in pixels<format>
is one of the image formats listed in thesupportedImageFormatTypes
attribute of the step 1 response. Note that the native format is usually the first value in the comma-separated list. For example,PNG32
in the case of aPNG32,PNG24,PNG,JPG,DIB,TIFF,EMF,PS,PDF,GIF,SVG,SVGZ,BMP
attribute value.download the image: GET the URL given by the
href
attribute the step 2ESRI Feature Server
Feature server provide vector data. They usually are capable of providing GeoJSON output. However, the feature drawing description language is very rich and may require significant resources to implement the openlayers-equivalent of esri-leaflet-renderers
Check the server capabilities: GET
<baseurl>/?f=json
where<baseurl>
is the user-provided map address.supportedQueryFormats
attribute.DrawingInfo
attribute.Retrieve the features using the
Query
API: GET<baseurl>/query?returnGeometry=true&where=1=1&outSr=4326&outFields=*&inSr=4326&geometry={"xmin":<xmin>,"ymin":<ymin>,"xmax":<xmax>,"ymax":<ymax>,"spatialReference":{"wkid":4326}}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&f=geojson
where<baseurl>
is the user-provided map address.<xmin>
,<ymin>
,<xmax>
, and<ymax>
are taken from the map bounding box in WGS84 (EPSG 4326) coordinates.