What's the official ESRI solution for serving up static map images (i.e. png, jpg, etc)?
Asked Answered
K

2

6

I need to write a map service that returns a single, static map image (png, jpg, etc). In the old days (i.e. before Google Maps took off) this was the default way that server software like ArcIMS worked. Now, those packages default serving tiled map services, which usually are the appropriate solution in most cases. However, in this case, my requirements are to return a single image that can be accessed by a URL.

I know that the Google Maps solution is their static map API. This works fine if you are creating a simple map, but my map will have polygon and point overlays, and probably to add as markers and encoded polygons w/in the confines of a 1024 char URL.

I have access to ArcGIS Server, and can create a map service that includes the above data, but I can't tell what is the best way to get the service to return a single image. The only thing I found in the ESRI online help was the ability to add OGC Web Map Service (WMS) capabilities to a map service. You can the request the map as an image, but this seems like a bit of a hack to me.

Does anyone know if there is a better/more official way?

Kussell answered 5/4, 2011 at 22:14 Comment(0)
D
7

If I understand what you want to do correctly, you can leverage the ArcGIS Server RESI API to do this. Using the REST API you can request a single image from an ArcGIS Server map service, and specify the bounding box, image size, image file type and numerous other parameters - and you get back a single image of that size, type etc.

The map service could be one that you have published on your ArcGIS Server (9.3 or higher). The service can be cached or dynamic. You can also utilize ArcGIS Online services, even to just to get a feel for this. So for example, go to the following URL:

http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer

And under "Supported Operations" at the bottom of the page, go to Export Map. Enter a size in the "Image Size" text box (for example: 1200,1200) along with any other parameters and click "Export Image".

You can get a feel for the acutal URL arguments by looking at the resulting URL for your request. You can get information about the parameters here (for example, for Export operation): http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/export.html

Now you mentioned creating a web service, so to do this programmatically you may be able to just hit the REST API directly. Or perhaps you'll want to create your own service as a wrapper around these REST API calls.

Hope this helps and I understood your question correctly.

Dzungaria answered 11/4, 2011 at 16:4 Comment(4)
Thanks Dave. That looks close to what I'm after. Ideally, I'd be able to embed the REST URL directly in the 'src' attribute of an 'img' tag, and from my cursory glance at the examples you sent it looks like the API generates the image, places it on a folder in the server, and then returns the URL. I will try w/ my test serviceKussell
There is a parameter/value f=image, which which the image bytes are directly streamed to the client, though I am still not sure that would allow you to embed the REST URL directly in the image tag or not. Your other option would be use your own web service or other mechanism to make the REST request and then embed the resulting image URL. Keep in mind those images are automatically cleaned up (deleted) from the AGS server at a specified interval (default 10 minutes I believe). So that link to the image is only valid for a short time. Good luck.Dzungaria
It works w/ the f=image parameter. I just embed the REST API url w/ that parameter into the image's src attribute. Works like a charm. Thanks! It looks like the WMS capabilities are just a wrapper around the export function to take in URLs in the WMS specified format.Kussell
Does this fall within their terms of service? Accessing tiles directly in google maps, for example, is not sanctioned.Endamage
V
4

I have just created:

  1. A custom class to let you do that, you can take a look here: https://github.com/esri-es/Static-Maps-API-ArcGIS
  2. A NodeJS script that works like Google Static Maps API: https://github.com/esri-es/Static-Map-Service-ArcGIS

Cheers, Raúl

Vidal answered 22/7, 2015 at 15:35 Comment(1)
Thanks for creating the static map project on GitHub - it looks great! In case you're still maintaining this, I just submitted a PR to fix a broken URL as it's currently failing at esri-es.github.io/Static-Maps-API-ArcGISHarsho

© 2022 - 2024 — McMap. All rights reserved.