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
Geo Tools
Commits
e2948939
Commit
e2948939
authored
Jan 20, 2016
by
Matija Obreza
Browse files
Coastal is more difficult than originally thought
parent
ddfe22b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
e2948939
...
...
@@ -13,7 +13,7 @@ Download the two "large split polygons" shapefiles in WGS84 projection from:
Shapefiles used in this application are derived from OSM data, © OpenStreetMap contributors.
Create a
`data`
subdirectory in the directory with the jar file.
Extract the
two
zip archives and move the
`.shp`
file
s into the newly created
`data/`
directory.
Extract the
shapefile
zip archives and move the
ir content
s into the newly created
`data/`
directory.
as the jar file of this application. You should now have three files in this directory:
$ find .
...
...
@@ -30,8 +30,12 @@ JAI library creates an AWT window. Run in headless mode:
Test.
= Features
*
Accepts CSV as input, produces CSV output
= TODO List
*
Accept CSV or Excel file as input source
*
Generate HTML report
*
For "Water" entries, report distance to closest land.
src/main/java/org/genesys/geotools/LandOrSeaCLI.java
View file @
e2948939
...
...
@@ -41,11 +41,8 @@ public class LandOrSeaCLI {
float
latitude
=
Float
.
parseFloat
(
matcher
.
group
(
1
).
replace
(
","
,
"."
));
float
longitude
=
Float
.
parseFloat
(
matcher
.
group
(
2
).
replace
(
","
,
"."
));
if
(
landOrSeaService
.
isOnLand
(
longitude
,
latitude
,
ALLOWED_DISTANCE_FROM_COAST
))
{
System
.
out
.
println
(
latitude
+
", "
+
longitude
+
", Land"
);
}
else
{
System
.
out
.
println
(
latitude
+
", "
+
longitude
+
", Water"
);
}
System
.
out
.
println
(
latitude
+
", "
+
longitude
+
", "
+
landOrSeaService
.
classifyLocation
(
longitude
,
latitude
,
ALLOWED_DISTANCE_FROM_COAST
));
}
else
{
System
.
err
.
println
(
"Invalid format: "
+
input
);
...
...
@@ -69,7 +66,7 @@ public class LandOrSeaCLI {
String
[]
nextLine
;
int
lineCount
=
0
;
while
((
nextLine
=
reader
.
readNext
())
!=
null
)
{
lineCount
++;
if
(
lineCount
%
10000
==
0
)
{
System
.
err
.
println
(
"FYI, "
+
lineCount
+
" entries have been processed."
);
...
...
src/main/java/org/genesys/geotools/LandOrSeaServiceImpl.java
View file @
e2948939
...
...
@@ -119,15 +119,16 @@ public class LandOrSeaServiceImpl implements LandOrSeaService {
return
"Water"
;
}
}
else
if
(
sourceLand
.
getFeatures
(
filterExact
).
size
()
>
0
)
{
// Create a buffer and check for Land
Filter
filterBuffered
=
ff
.
intersects
(
ff
.
property
(
"the_geom"
),
ff
.
literal
(
getPointBuffer
(
point
,
allowedDistanceFromLand
)));
if
(
sourceWater
.
getFeatures
(
filterBuffered
).
size
()
>
0
)
{
return
"Coastal"
;
}
else
{
return
"Land"
;
}
// // Create a buffer and check for water
// Filter filterBuffered =
// ff.intersects(ff.property("the_geom"),
// ff.literal(getPointBuffer(point, allowedDistanceFromLand)));
//
// if (sourceWater.getFeatures(filterBuffered).size() > 0) {
// return "Coastal";
// } else {
return
"Land"
;
// }
}
else
{
throw
new
Exception
(
"Can't figure out the result for "
+
longitude
+
","
+
latitude
+
" with distance="
+
allowedDistanceFromLand
);
...
...
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