I am using python and my code is like:
from geojson import Feature, FeatureCollection
import json
import sys, pymongo
db = pymongo.MongoClient(host = '..........').database
coll_name = sys.argv[1]
point_list = []
citymap_cursor = db[coll_name].find()
for doc in citymap_cursor:
point_list.append(Feature(geometry=doc['point_latlng']))
with open('/path to/%s.json' % coll_name, 'w+') as outfile:
json.dump(FeatureCollection(point_list), outfile)
By this code I got a batch of points and I can use geojson.io to visualize the points. Now these point markers are grey on geojson.io but I want them to be red. I want to know whether these is an attribute about color in geojson.Feature so that I can adjust the marker color?
Yes, you can manipulate the marker colors with a marker-color
key inside the properties
object. You pass it a hex color like {"marker-color":"#FFF"}
. I assume you will be doing this inside your for doc in citymap_cursor:
loop - something like point_list.append(Feature(geometry=doc['point_latlng'],properties={'marker-color':'#FFF'}))