32 | | Example: |
33 | | {{{ |
34 | | query = (db.gis_location.deleted == False) |
35 | | query = query & (db.gis_location.id == db["%s_%s" % (module, resource)].location_id) |
36 | | locations = db(query).select(db.gis_location.id, db.gis_location.uuid, db.gis_location.name, db.gis_location.wkt, db.gis_location.lat, db.gis_location.lon) |
37 | | for i in range(0, len(locations)): |
38 | | locations[i].gis_location.shape = "circle" |
39 | | locations[i].gis_location.size = locations[i][db["%s_%s" % (module, resource)].MyIntegerField] |
40 | | }}} |
| 32 | There are 3 basic approaches: |
| 33 | 1. Use a style JSON: |
| 34 | * https://github.com/flavour/eden/blob/master/modules/templates/IFRC/gis_layer_feature.csv#L6 |
| 35 | NB This only supports styling based on a single attribute & you need to add that to attr_fields |
| 36 | |
| 37 | 2. Use a marker_fn: |
| 38 | * https://github.com/flavour/eden/blob/master/modules/templates/NYC/config.py#L302 |
| 39 | * https://github.com/flavour/eden/blob/master/modules/templates/NYC/config.py#L430 |
| 40 | This supports whatever lookups you want in Python...you don't pass the attr_field to client but this will pass the marker_url/marker_hight/marker_width in every record which will almost certainly be bulkier |
| 41 | |
| 42 | 3. feature_queries |
| 43 | These are only supported in custom maps & always get loaded with the page...so cannot be refreshed via AJAX |