Hot answers tagged

38

There are many things you can do with the GeoServer REST API that are not specifically documented and that there are not code examples for. Here's the strategy for tackling those. First, start with the examples in the documentation. Make sure you are familiar with how you can create a simple new layer or workspace using an HTTP POST with either XML or JSON. ...


9

I know this is an old question, but just in case anyone else is confused as I was. The important part is that you cannot create a layer from the http://geoserver/rest/layers endpoint. If you are looking to add a vector layer, it is done through the feature type resource: http://docs.geoserver.org/stable/en/user/rest/api/featuretypes.html A POST to: /...


9

You should have a look at the REST Help for GP Task To run the geoprocessing task, you need to provide an input. If your GP Service is Synchronous, then you need to call the Execute Operation. If your service is Asynchronous, then you need to call the SubmitJob Operation. Both of them take their input parameter in JSON Format. In the case of a Synchronous ...


8

ArcGIS for Server will give you JSON over HTTP. Python has HTTP client stuff built in (urllib, etc) and better community packages (Requests, httplib2). And JSON and Python go together like chips and salsa.


6

Unfortunately this is not documented in the api reference or samples. But here is the gist of it. First create the store: POST /rest/workspaces/<ws>/wmsstores <wmsStore> <name>wms</name> <capabilitiesURL>http://somehost/wms?</capabilitiesURL> <workspace>sf</workspace> </wmsStore> And then ...


6

Use esri.request() to hit each layer's REST endpoint to get info about fields. Here's a simple example: <html> <head> <script type="text/javascript">var djConfig = {parseOnLoad: true};</script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.4"></script> <script ...


6

I was able to do it using geoserver-manager. The code is: GeoServerRESTPublisher geoServerRESTPublisher = new GeoServerRESTPublisher("http://localhost:8090/geoserver", "admin", "geoserver"); geoServerRESTPublisher.publishGeoTIFF("myWS", "myTiff", "myTiff", new File("d:\\work\\myTiff.tif"), "EPSG:900913", GSResourceEncoder.ProjectionPolicy....


6

It's a combination of two things really. 1) How much information can your server handle sending at a given time. 2) How much information can your client handle displaying. I can't answer "why" 1000. A good a guess as any, 1000 individual features drawn on a webmap would really tax the web browser and performance would suffer (a few years back). You can make ...


6

As @PolyGeo suggested, I am converting my comments into an answer. The answer is split into three parts to broadly reflect the three comments I made. Part 1 Roy Fielding's dissertation that described Representational State Transfer (REST) amongst other architectural styles Architectural Styles and the Design of Network-based Software Architectures was ...


5

I've been able to achieve this using the code segments below. But it'll be great if someone can come up with a better solution. Part I: Uploading a shape file to GeoServer without PostGIS public bool UploadShapeFile(string workspace, string dsName, Uri zipUri) { String fileUri = zipUri.AbsolutePath; Console.Write(fileUri); ...


5

Maybe you can try this after creating the workspace: curl -u admin:geoserver -v -XPOST -H 'Content-Type: application/xml' \ -d '<coverageStore><name>int_dec</name><workspace>restProba</workspace> <enabled>true</enabled></coverageStore>' \ http://localhost:8080/geoserver/rest/workspaces/...


5

You cannot directly access the tiles without circumventing the T&C of google's API. If you want the map as an image you can do that with Google Maps Static API.


5

You can use the Identify Operation on the Mapservice to get the pixel values from the raster. Using the Identify Operation on a map service with Rasters, I can get both the Pixel value, as well as the stretched values:


4

You can now Cancel jobs and return Z and M as of ArcGIS REST API 10.1 Submit GP Job (now with option to returnZ and returnM) Cancel GP Job


4

It's entirely possible, but nobody's done it yet. Arc2Earth uses an independent implementation of the Esri REST API to host on Google App Engine. And implementing the REST API makes it possible to do things like expose geoprocessing services and feature layers for analysis in ArcGIS Explorer.


4

It's harder than it sounds. Django Models are, at the moment, pretty tied to a SQL database world and the Admin is, in turn, pretty tied to Django models. Your best bet is probably to look at something like Django-nonrel http://www.allbuttonspressed.com/projects/django-nonrel


4

I just tested a GET and POST request with my custom SOE, and it accepts both GET and POST requests just fine without any special configuration. postOnly=true as you know will force POST only requests, and should be used when data is modified. What kind of a response do you get when you try and submit a POST request to your SOE?


4

It's hard, but not impossible, to hide a password, even from root. The trick is to save the password in a password protected keyring (like the Gnome Keyring), unlock the Keyring once and then (from the same session!) run a script like the following (written in python). Please note that even if root can su to your account he still cannot open the Keyring ...


4

You'll be able to in 10.1 SP1. When you run a geoprocessing tool in Python, its return value is a result object. There will be a new arcpy.CreateGPSDraft function what accepts these result objects and from there the workflow from Python will be exactly the same as it is with map services now.


4

Unless your app is written in Java then the REST approach is the most elegant as it can be coded in any language that has an HTTP lib (all of them). Any solution using selenium or something similar should be an absolute last resort, changes to the REST API will likely remain backward compatible so you can upgrade GeoServer with confidence, the UI will ...


4

You don't have to use cURL. You can use anything that can interact with the HTTP protocol. This includes your web browser, Linux shell (or PowerShell in Windows), PHP, Java etc. If you want to use Python you will probably want to download the Requests library so make things easier because, while the standard library can handle REST requests, it is a pain. ...


4

What @Iant said. As the GeoServer RESTful interface docs says: GeoServer provides a RESTful interface through which clients can retrieve information about an instance and make configuration changes. Using the REST interface’s simple HTTP calls, clients can configure GeoServer without needing to use the Web Administration Interface. So ...


4

Turns out that ESRI just added this feature, but only for users of ArcGis server - the public server will have it turned off. The feature is called ExportTiles and it has been introduced in 10.2.1 for REST API: It'll export things into ArcGis's .Tpk or bundled image formats.


4

Regarding your question as to whether you can edit a feature layer using the REST API, the answer is yes. See the Apply Edits section of the REST API for documentation on how do this this. However, if it's only the status of the alarms which is changing every 15 minutes, you could make the change purely within the web map (without needing to change the ...


4

Try this: curl -v -u admin:geoserver -XDELETE http://localhost:8080/geoserver/rest/my_ws/coveragestores/my_cover?recurse=true You have a space between -X and DELETE Example can be seen at the REST API Docs curl -v -u admin:geoserver -XDELETE "http://localhost:8080/geoserver/rest/workspaces/topp/coveragestores/polyphemus-v1/coverages/NO2/index/granules....


4

I'm successfully using this method to obtain a token: def get_token(): # Retrieve a token from ArcGIS Online to enable access to private services token_params = { 'client_id': "your_client_id", 'client_secret': "your_client_secret", 'grant_type': "client_credentials" } request = requests.get('https://www.arcgis.com/...


4

The JSON returned from that URL does not look like it conforms to any standard format. Any system that could map from that URL would have to know it was an array, with an array of "weatherStations" and each of those elements had an array of "sensorValues" and in each of those is eventually a measurement and a description of what that measurement meant. ...


4

Editing ArcGIS Feature Service layers is not possible in any current QGIS version (as of August 2018).


3

attributes: The feature attributes. It is a JSON object that contains a dictionary of name-value pairs. The names are the feature field names. The values are the field values and they can be any of the standard JSON types - string, number and boolean. Note that date values are encoded as numbers. The number represents the number of milliseconds since epoch (...


3

To check if the service is secured from the GIS Tier, you can use the ArcGIS for Server Admin API. Query the REST end point is this http://yourserver:6080/arcgis/admin/services/yourservice.MapServer/permissions If the REST end point returned "esriEveryone", it means it is public. Else it will return the permitted Roles or Group who can access this service....


Only top voted, non community-wiki answers of a minimum length are eligible