Hot answers tagged

41

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. ...


10

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.


7

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

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

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

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:


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

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

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

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

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

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

To get json (or geojson) from PostGIS there is the function ST_geojson() which will return a geometric object in geojson form.


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....


3

A POST will always create a new resource and redirect you to it once created. If you want to either create a new one or replace an existing one you must use PUT instead. Mind, it will overwrite fully an existing layer group (btw, haven't tried it out, the above is just based on what you should expect from a REST based API).


3

I think GeoMajas is a good choice. For routing purposes I want to introduce you Graphhopper. It's still a young project, but it's java, it's incredibly fast and there are ready to use applications to route either on a web server or on the mobile device itself based on openstreetmap data. So if you have no problems to use openstreetmap and want to route on a ...


3

you have to go through geoserver's wms service: http://GEOSERVERBASE/geoserver/wms? service=WMS& version=1.1.1& request=GetMap& layers=jantrik:Storm_Mains& styles=&format=image/png& TRANSPARENT=TRUE& srs=EPSG:2000& bbox=11879566.92588,7000626.9713143,11880134.841974,7001041.8162735& ...


3

From ESRI Help: Maximum number of records returned by the server: Clients, such as the ArcGIS web APIs, can perform query operations to return specific information, or records, from a map service. This property specifies how many records can be returned by the server to a client for any given query operation. Specifying a large number of records to be ...


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