1

I am querying a feature layer provided in ArcGIS Online as explained in the Query (Feature Service) documentation. Everywhere there are examples using JavaScript. I am not able to find any documentation or examples using Java.

I have tried the same thing using Spring's RestTemplate class as below

 MultiValueMap<String, String> variables = new LinkedMultiValueMap<>();
 variables.add("where", "1 = 1");
 variables.add("f", "json");
 variables.add("outFields", "*");

 HttpHeaders headers = new HttpHeaders();
 headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);

 HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<>(variables, headers);

 RestTemplate restTemplate = new RestTemplate();

 String queryData = restTemplate.postForObject(this.SERVICE_FEATURE_URL + "/query", entity, String.class);

Here instead of getting the result as a String object, is it possible to get the data as an ArcGIS Java class object?

P.S. I know how to get the arcgis-java dependency using Maven:

<dependency>
    <groupId>com.esri.arcgisruntime</groupId>
    <artifactId>arcgis-java</artifactId>
    <version>100.2.1</version>
</dependency>
Gary Sheppard
  • 4,764
  • 3
  • 25
  • 35
Naveen Kumar H S
  • 1,304
  • 16
  • 30
  • 1
    I don't have a good answer for this, but here are three things I do know. 1) You'll probably have to write your own `HttpMessageConverter` (see https://stackoverflow.com/a/21857557/720773 ). 2) Even if you do, ArcGIS Runtime (the `arcgis-java` library) can't be used in a server process (see the FAQ in https://developers.arcgis.com/arcgis-runtime/licensing/ ), so if you're building a web app, it's probably not worth the trouble to write a custom converter that you can't use. 3) Because of #1 and #2, I think you're better off using a Java JSON library to parse the response into a JSON object. – Gary Sheppard May 29 '18 at 16:40

0 Answers0