Currently working on a project to plot addresses in Meteor using Leaflet and Data Science Toolkit (DSTK) for geocoding. Sending a curl POST request with three addresses I get the following data returned:
{ "901 North Jackson Street, Junction City KS 66441": {
"country_code3": "USA",
"latitude": 39.031397,
"country_name": "United States",
"longitude": -96.837184,
"street_address": "901 N Jackson St",
"region": "KS",
"confidence": 1.0,
"street_number": "901",
"locality": "Junction City",
"street_name": "N Jackson St",
"fips_county": "20061",
"country_code": "US" },
"300 South Parkside Drive, Colorado Springs CO 80901": {
"country_code3": "USA",
"latitude": 38.828775,
"country_name": "United States",
"longitude": -104.79034,
"street_address": "300 S Parkside Dr",
"region": "CO",
"confidence": 0.805,
"street_number": "300",
"locality": "Colorado Springs",
"street_name": "S Parkside Dr",
"fips_county": "08041",
"country_code": "US" },
"1412 Kensington Avenue, Kansas City MO 64127": {
"country_code3": "USA",
"latitude": 39.095286,
"country_name": "United States",
"longitude": -94.530828,
"street_address": "1412 Kensington Ave",
"region": "MO",
"confidence": 1.0,
"street_number": "1412",
"locality": "Kansas City",
"street_name": "Kensington Ave",
"fips_county": "29095",
"country_code": "US" } }
What I'm trying to do is loop through those results and insert into mongodb in Geojson format. Using the last address from above it would look like the following:
var geojsonFeature = {
"type": "Feature",
"properties": {
"name": "1412 Kensington Avenue, Kansas City MO 64127",
"popupContent": "1412 Kensington Avenue, Kansas City MO 64127"
},
"geometry": {
"type": "Point",
"coordinates": [-94.530828, 39.095286]
}
};
Any suggestions are greatly appreciated.