Skip to main content

As in comments: Just add coordinates.

inJson['loc_lng']inJson['loc_lng'] it is doubled! (I see only one coordinates.)

For example:

var inJson = {
"STATE_ABBR": "AK",
"file_name": "addresses",
"AREA_WATER": "2.45383480336E11",
"AREA_LAND": "1.47795321158E12",
"loc_address": "Kenai Spur Hwy, Kenai, AK 99611, USA",
"STATE_NAME": "Alaska",
"PERSONS": "710231",
"address_type": "church",
"MALE": "369628",
"location_type": "GEOMETRIC_CENTER",
"loc_lng": "-151.1820715",
"loc_name": "Kenai Fellowship",
"FEMALE": "340603",
"loc_id": "10672"
}



var outGeoJson = {}
outGeoJson['properties'] = inJson
outGeoJson['type']= "Feature"
outGeoJson['geometry']= {"type": "Point", "coordinates":
[inJson['loc_lng'], inJson['loc_lng']]}

console.log(outGeoJson)
var inJson = {
    "STATE_ABBR": "AK",
    "file_name": "addresses",
    "AREA_WATER": "2.45383480336E11",
    "AREA_LAND": "1.47795321158E12",
    "loc_address": "Kenai Spur Hwy, Kenai, AK 99611, USA",
    "STATE_NAME": "Alaska",
    "PERSONS": "710231",
    "address_type": "church",
    "MALE": "369628",
    "location_type": "GEOMETRIC_CENTER",
    "loc_lng": "-151.1820715",
    "loc_name": "Kenai Fellowship",
    "FEMALE": "340603",
    "loc_id": "10672"
}

var outGeoJson = {}
outGeoJson['properties'] = inJson
outGeoJson['type']= "Feature"
outGeoJson['geometry']= {"type": "Point", "coordinates":
    [inJson['loc_lng'], inJson['loc_lng']]}

console.log(outGeoJson)

As in comments: Just add coordinates.

inJson['loc_lng'] it is doubled! (I see only one coordinates.)

For example:

var inJson = {
"STATE_ABBR": "AK",
"file_name": "addresses",
"AREA_WATER": "2.45383480336E11",
"AREA_LAND": "1.47795321158E12",
"loc_address": "Kenai Spur Hwy, Kenai, AK 99611, USA",
"STATE_NAME": "Alaska",
"PERSONS": "710231",
"address_type": "church",
"MALE": "369628",
"location_type": "GEOMETRIC_CENTER",
"loc_lng": "-151.1820715",
"loc_name": "Kenai Fellowship",
"FEMALE": "340603",
"loc_id": "10672"
}



var outGeoJson = {}
outGeoJson['properties'] = inJson
outGeoJson['type']= "Feature"
outGeoJson['geometry']= {"type": "Point", "coordinates":
[inJson['loc_lng'], inJson['loc_lng']]}

console.log(outGeoJson)

As in comments: Just add coordinates.

inJson['loc_lng'] it is doubled! (I see only one coordinates.)

For example:

var inJson = {
    "STATE_ABBR": "AK",
    "file_name": "addresses",
    "AREA_WATER": "2.45383480336E11",
    "AREA_LAND": "1.47795321158E12",
    "loc_address": "Kenai Spur Hwy, Kenai, AK 99611, USA",
    "STATE_NAME": "Alaska",
    "PERSONS": "710231",
    "address_type": "church",
    "MALE": "369628",
    "location_type": "GEOMETRIC_CENTER",
    "loc_lng": "-151.1820715",
    "loc_name": "Kenai Fellowship",
    "FEMALE": "340603",
    "loc_id": "10672"
}

var outGeoJson = {}
outGeoJson['properties'] = inJson
outGeoJson['type']= "Feature"
outGeoJson['geometry']= {"type": "Point", "coordinates":
    [inJson['loc_lng'], inJson['loc_lng']]}

console.log(outGeoJson)
Source Link
user7172
  • 1.5k
  • 2
  • 25
  • 47

As in comments: Just add coordinates.

inJson['loc_lng'] it is doubled! (I see only one coordinates.)

For example:

var inJson = {
"STATE_ABBR": "AK",
"file_name": "addresses",
"AREA_WATER": "2.45383480336E11",
"AREA_LAND": "1.47795321158E12",
"loc_address": "Kenai Spur Hwy, Kenai, AK 99611, USA",
"STATE_NAME": "Alaska",
"PERSONS": "710231",
"address_type": "church",
"MALE": "369628",
"location_type": "GEOMETRIC_CENTER",
"loc_lng": "-151.1820715",
"loc_name": "Kenai Fellowship",
"FEMALE": "340603",
"loc_id": "10672"
}



var outGeoJson = {}
outGeoJson['properties'] = inJson
outGeoJson['type']= "Feature"
outGeoJson['geometry']= {"type": "Point", "coordinates":
[inJson['loc_lng'], inJson['loc_lng']]}

console.log(outGeoJson)