Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
3babf724
Commit
3babf724
authored
May 09, 2014
by
Matija Obreza
Browse files
Download KML from /explore/map
parent
df356f9b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/servlet/controller/ExplorerController.java
View file @
3babf724
...
...
@@ -340,9 +340,17 @@ public class ExplorerController extends BaseController {
public
String
map
(
ModelMap
model
,
@RequestParam
(
value
=
"crop"
,
required
=
false
,
defaultValue
=
""
)
String
cropName
,
@RequestParam
(
value
=
"filter"
,
required
=
false
,
defaultValue
=
"{}"
)
String
jsonFilter
)
{
Crop
crop
=
null
;
if
(
StringUtils
.
isNotBlank
(
cropName
))
{
crop
=
cropService
.
getCrop
(
cropName
);
if
(
crop
==
null
)
{
throw
new
ResourceNotFoundException
(
"No crop "
+
cropName
);
}
}
ObjectNode
jsonTree
=
updateFilterWithCrop
(
cropName
,
jsonFilter
);
model
.
addAttribute
(
"jsonFilter"
,
jsonTree
.
toString
());
model
.
addAttribute
(
"crop"
,
crop
);
return
"/accession/map"
;
}
...
...
@@ -396,11 +404,15 @@ public class ExplorerController extends BaseController {
return
jsonTree
;
}
@RequestMapping
(
value
=
"/explore/kml"
,
produces
=
"application/vnd.google-earth.kml+xml"
)
@RequestMapping
(
value
=
"/explore/kml"
,
produces
=
"application/vnd.google-earth.kml+xml"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
String
kml
(
@RequestParam
(
value
=
"crop"
,
required
=
false
,
defaultValue
=
""
)
String
cropName
,
@RequestParam
(
value
=
"filter"
,
required
=
true
)
String
jsonFilter
)
{
@RequestParam
(
value
=
"filter"
,
required
=
true
)
String
jsonFilter
,
HttpServletResponse
response
)
{
ObjectNode
jsonTree
=
updateFilterWithCrop
(
cropName
,
jsonFilter
);
response
.
setContentType
(
"application/vnd.google-earth.kml+xml"
);
response
.
addHeader
(
"Content-Disposition"
,
String
.
format
(
"attachment; filename=\"genesys-kml-filtered.kml\""
));
return
mappingService
.
filteredKml
(
jsonTree
.
toString
());
}
...
...
src/main/resources/content/language.properties
View file @
3babf724
...
...
@@ -496,3 +496,5 @@ article.classPk=Object
session.expiry-warning-title
=
Session expiration warning
session.expiry-warning
=
Your current session is about to expire. Do you wish to extend this session?
session.expiry-extend
=
Extend session
download.kml
=
Download KML
src/main/webapp/WEB-INF/jsp/accession/map.jsp
View file @
3babf724
...
...
@@ -11,10 +11,26 @@
<spring:message
code=
"maps.accession-map"
/>
</h1>
<div
class=
"main-col-header"
>
<a
href=
"javascript: window.history.go(-1);"
><spring:message
code=
"navigate.back"
/></a>
<a
class=
""
href=
"
<c:url
value=
"/explore"
/>
"
id=
"selectArea"
>
View accessions
</a>
<div
class=
"main-col-header clearfix"
>
<div
class=
"nav-header"
>
<form
class=
"pull-right form-horizontal"
method=
"post"
action=
"/explore/kml"
>
<input
type=
"hidden"
name=
"${_csrf.parameterName}"
value=
"${_csrf.token}"
/>
<input
type=
"hidden"
name=
"crop"
value=
"${crop.shortName}"
/>
<input
type=
"hidden"
name=
"filter"
value=
"
<c:out
value=
"
${
jsonFilter
}
"
/>
"
/>
<div
class=
"row"
>
<div
class=
"col-sm-4"
>
<button
class=
"btn btn-default"
type=
"submit"
><spring:message
code=
"download.kml"
/></button>
</div>
</div>
</form>
<div
class=
"results"
>
<a
href=
"javascript: window.history.go(-1);"
><spring:message
code=
"navigate.back"
/></a>
<a
class=
""
href=
"
<c:url
value=
"/explore"
/>
"
id=
"selectArea"
>
View accessions
</a>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
id=
"map"
class=
"gis-map gis-map-square"
></div>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment