Ticket #43 (new task)

Opened 5 years ago

Last modified 5 years ago

develop an image manager service that works with GeoServer

Reported by: tschaub Owned by:
Priority: major Milestone:
Component: Styler Keywords:
Cc: Total Hours: 0.0
Estimated Hours: 0

Description (last modified by tschaub) (diff)

So, AtomPub is an attractive option for managing images in GeoServer. However, browsers can't implement the proposed multipart media creation  proposal for AtomPub (for multipart data, we are stuck with multipart/form-data and cannot set headers when posting data from the client filesystem).

So, we can use regular old multipart/form-data for creating new resources (posting a file from the client filesystem). The design proposal suggests that a url can be submitted to create a new resource. We could do Atom here, but it seems silly to mix content types. So, we agree on parameter names and use form-encoding (unless someone else has a different proposal).

In terms of getting information about image resources, Atom would make a good transport format. Of course JSON will always be easier to handle when the client is a browser.

Anyway, interaction would look something like this:

Request

GET /geoserver/images/

Response (in whatever content type, json below)

{
    images: [
        {
            id: "1",
            title: "Railroad Station",
            categories: ["transportation"],
            links: [
                {
                    rel: "self",
                    type: "image/png",
                    href: "http://example.org/geoserver/images/1.png"
                }, {
                    rel: "alternate",
                    type: "application/json",
                    href: "http://example.org/geoserver/images/1.json"
                }
            ]
        }
    ]
}

If the client posts an image from their filesystem, the request might look like the following:

POST /geoserver/images/
Content-Type: multipart/form-data; boundary=AaB03x

--AaB03x
Content-Disposition: form-data; name="title"

Major City
--AaB03x
Content-Disposition: form-data; name="categories"

political
--AaB03x
Content-Disposition: form-data; name="categories"

demographic
--AaB03x
Content-Disposition: form-data; name="image"; filename="big_city.png"
Content-Type: image/png
Content-Transfer-Encoding: binary

... contents of big_city.png ...
--AaB03x--

And the response would be a 201 with some representation of the new resource (perhaps like the json above).

The design documents show the user being able to create a new resource by submitting a url for an image already online. I'd suggest that this is not completely necessary. If implemented, it would keep things simpler to have GeoServer fetch the image and store a copy - so we don't have to deal with two image types (local and remote) when requesting a list of resources. If not implemented, then the user downloads the image first before posting.

Change History

Changed 5 years ago by tschaub

  • description modified (diff)
Note: See TracTickets for help on using tickets.