Search in sources :

Example 1 with RecordCoordinatesKmlGeneratorJob

use of org.openforis.collect.model.RecordCoordinatesKmlGeneratorJob in project collect by openforis.

the class GeoDataController method createCoordinateValuesKML.

@RequestMapping(value = "survey/{surveyId}/data/coordinatesvalues.kml", method = GET, produces = KML_CONTENT_TYPE)
public void createCoordinateValuesKML(@PathVariable("surveyId") int surveyId, @RequestParam int stepNum, @RequestParam int coordinateAttributeId, HttpServletResponse response) throws Exception {
    CollectSurvey survey = surveyManager.getById(surveyId);
    CoordinateAttributeDefinition nodeDef = (CoordinateAttributeDefinition) survey.getSchema().getDefinitionById(coordinateAttributeId);
    RecordCoordinatesKmlGeneratorJob job = new RecordCoordinatesKmlGeneratorJob();
    job.setRecordManager(recordManager);
    RecordFilter filter = new RecordFilter(survey);
    job.setRecordFilter(filter);
    job.setNodeDefinition(nodeDef);
    job.setOutput(response.getOutputStream());
    CoordinateOperations coordinateOperations = survey.getContext().getCoordinateOperations();
    coordinateOperations.registerSRS(survey.getSpatialReferenceSystems());
    job.setCoordinateOperations(coordinateOperations);
    jobManager.start(job, false);
}
Also used : CoordinateAttributeDefinition(org.openforis.idm.metamodel.CoordinateAttributeDefinition) CoordinateOperations(org.openforis.idm.geospatial.CoordinateOperations) CollectSurvey(org.openforis.collect.model.CollectSurvey) RecordCoordinatesKmlGeneratorJob(org.openforis.collect.model.RecordCoordinatesKmlGeneratorJob) RecordFilter(org.openforis.collect.model.RecordFilter) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

CollectSurvey (org.openforis.collect.model.CollectSurvey)1 RecordCoordinatesKmlGeneratorJob (org.openforis.collect.model.RecordCoordinatesKmlGeneratorJob)1 RecordFilter (org.openforis.collect.model.RecordFilter)1 CoordinateOperations (org.openforis.idm.geospatial.CoordinateOperations)1 CoordinateAttributeDefinition (org.openforis.idm.metamodel.CoordinateAttributeDefinition)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1