Skip to content

Commit 878a7fc

Browse files
committed
show message for non-wgs84 #19
1 parent 15b850c commit 878a7fc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/components/JsonToGeojsonForm.vue

+16-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,19 @@
33
<div class="form-group">
44
<textarea rows="10" class="form-control" v-bind:placeholder="placeholder" v-model="inputJson"></textarea>
55
</div>
6+
67
<div class="form-group float-right">
78
<button type="button" class="btn btn-primary" v-on:click.prevent="convert()">Convert</button>
89
</div>
910

11+
<div class="form-row align-items-center" v-if="showWgs84Alert">
12+
<div class="col">
13+
<div class="alert alert-warning" role="alert">
14+
It looks like your FeatureSet has features with geometries with spatial references not in Latitude/Longitude (WGS84). In general, GeoJSON only works with WGS84, which is why the map probably looks wrong, so you probably want to change your input data to have that spatial reference. Try setting the "Output Sptaial Reference" to 4326.
15+
</div>
16+
</div>
17+
</div>
18+
1019
<div class="form-group">
1120
<textarea rows="10" class="form-control" v-show="showResultArea" v-model="resultJsonString"></textarea>
1221
</div>
@@ -30,7 +39,8 @@ export default {
3039
return {
3140
inputJson: '',
3241
resultJson: '',
33-
prettyPrint: true
42+
prettyPrint: true,
43+
showWgs84Alert: false
3444
};
3545
},
3646
computed: {
@@ -45,6 +55,11 @@ export default {
4555
convert: function() {
4656
try {
4757
const inputJson = JSON.parse(this.inputJson);
58+
59+
this.showWgs84Alert = false;
60+
if(inputJson.hasOwnProperty('spatialReference') && inputJson.spatialReference.hasOwnProperty('wkid') && inputJson.spatialReference.wkid !==4326) {
61+
this.showWgs84Alert = true;
62+
}
4863
// if this is an object, assume FeatureSet. If array, assume array of features.
4964
let features = inputJson;
5065
if(!Array.isArray(inputJson)) {

0 commit comments

Comments
 (0)