Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-haz
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Seismic Hazard Model Project
nshmp-haz
Commits
25d9725b
Commit
25d9725b
authored
7 years ago
by
Powers, Peter M.
Browse files
Options
Downloads
Patches
Plain Diff
geojson 269 update
parent
d30c85f9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!270
Deagg by source, hazout, and geojson
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/gov/usgs/earthquake/nshmp/internal/GeoJson.java
+19
-7
19 additions, 7 deletions
src/gov/usgs/earthquake/nshmp/internal/GeoJson.java
with
19 additions
and
7 deletions
src/gov/usgs/earthquake/nshmp/internal/GeoJson.java
+
19
−
7
View file @
25d9725b
...
@@ -95,21 +95,22 @@ public final class GeoJson {
...
@@ -95,21 +95,22 @@ public final class GeoJson {
key
,
value
,
actual
);
key
,
value
,
actual
);
}
}
/* GeoJSON objectsfor stadard GSON serialization */
/* GeoJSON objects
for sta
n
dard GSON serialization */
static
class
FeatureCollection
{
public
static
class
FeatureCollection
<
T
>
{
String
type
=
"FeatureCollection"
;
String
type
=
"FeatureCollection"
;
List
<
Feature
>
features
;
public
Object
properties
;
public
List
<
T
>
features
;
}
}
static
class
Feature
{
public
static
class
Feature
{
String
type
=
"Feature"
;
String
type
=
"Feature"
;
String
id
;
String
id
;
Geometry
geometry
=
new
Geometry
();
Geometry
geometry
=
new
Geometry
();
PropertiesObject
properties
;
PropertiesObject
properties
;
}
}
static
Feature
createPoint
(
NamedLocation
loc
)
{
public
static
Feature
createPoint
(
NamedLocation
loc
)
{
Feature
f
=
new
Feature
();
Feature
f
=
new
Feature
();
f
.
geometry
.
type
=
"Point"
;
f
.
geometry
.
type
=
"Point"
;
f
.
geometry
.
coordinates
=
toCoordinates
(
loc
.
location
());
f
.
geometry
.
coordinates
=
toCoordinates
(
loc
.
location
());
...
@@ -118,6 +119,16 @@ public final class GeoJson {
...
@@ -118,6 +119,16 @@ public final class GeoJson {
return
f
;
return
f
;
}
}
public
static
Feature
createPoint
(
NamedLocation
loc
,
String
id
)
{
Feature
f
=
new
Feature
();
f
.
geometry
.
type
=
"Point"
;
f
.
geometry
.
coordinates
=
toCoordinates
(
loc
.
location
());
f
.
properties
=
new
PropertiesObject
();
f
.
properties
.
location
=
loc
.
toString
();
f
.
properties
.
locationId
=
id
;
return
f
;
}
private
static
final
String
EXTENTS_COLOR
=
"#AA0078"
;
private
static
final
String
EXTENTS_COLOR
=
"#AA0078"
;
static
Feature
createPolygon
(
static
Feature
createPolygon
(
...
@@ -154,6 +165,8 @@ public final class GeoJson {
...
@@ -154,6 +165,8 @@ public final class GeoJson {
static
class
PropertiesObject
{
static
class
PropertiesObject
{
String
title
;
String
title
;
String
location
;
String
locationId
;
}
}
static
class
PointProperties
extends
PropertiesObject
{
static
class
PointProperties
extends
PropertiesObject
{
...
@@ -182,7 +195,7 @@ public final class GeoJson {
...
@@ -182,7 +195,7 @@ public final class GeoJson {
}
}
/* brute force compaction of coordinate array onto single line */
/* brute force compaction of coordinate array onto single line */
static
String
cleanPoints
(
String
s
)
{
public
static
String
cleanPoints
(
String
s
)
{
return
s
.
replace
(
": [\n "
,
": ["
)
return
s
.
replace
(
": [\n "
,
": ["
)
.
replace
(
",\n "
,
", "
)
.
replace
(
",\n "
,
", "
)
.
replace
(
"\n ]"
,
"]"
)
+
"\n"
;
.
replace
(
"\n ]"
,
"]"
)
+
"\n"
;
...
@@ -197,5 +210,4 @@ public final class GeoJson {
...
@@ -197,5 +210,4 @@ public final class GeoJson {
.
replace
(
"\n ]"
,
" ]"
)
.
replace
(
"\n ]"
,
" ]"
)
.
replace
(
"\n ]"
,
"]"
)
+
"\n"
;
.
replace
(
"\n ]"
,
"]"
)
+
"\n"
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment