How can I display marker labels? #6118
Replies: 2 comments
-
Hi @zdefne-usgs Currently we don't support labels for CSV. There are two other options:
CZML fileTerriaJS supports CZML which can be used to draw points and labels. So you can generate your own CZML files See https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/CZML-Guide for file structure Example CZML[
{
"id": "document",
"name": "CZML Point",
"version": "1.0"
},
{
"id": "point 1",
"name": "point",
"position": {
"cartographicDegrees": [-111.0, 40.0, 0]
},
"point": {
"color": {
"rgba": [255, 255, 255, 255]
},
"outlineColor": {
"rgba": [255, 0, 0, 255]
},
"outlineWidth": 4,
"pixelSize": 20
},
"label": {
"style": {
"labelStyle": "FILL_AND_OUTLINE"
},
"fillColor": {
"rgba": [0, 0, 0, 255]
},
"outlineColor": {
"rgba": [255, 255, 255, 255]
},
"outlineWidth": 2,
"text": "Hello",
"pixelOffset": {
"cartesian2": [60, 0]
}
}
}
] GeoJSON with CZML TemplateAlternatively, we have Catalog JSON example
{
"id": "geojson-czml-label",
"name": "geojson-czml-label",
"url": "build/TerriaJS/test/GeoJSON/points.geojson",
"type": "geojson",
"czmlTemplate": {
"point": {
"pixelSize": 10
},
"label": {
"horizontalOrigin": "LEFT",
"heightReference": {
"heightReference": "RELATIVE_TO_GROUND"
},
"scale": 1,
"style": {
"labelStyle": "FILL_AND_OUTLINE"
},
"fillColor": {
"rgba": [
0,
0,
0,
255
]
},
"outlineColor": {
"rgba": [
255,
255,
255,
255
]
},
"outlineWidth": 2,
"text": {
"reference": "#properties.someOtherProp"
},
"eyeOffset": {
"cartesian": [
10,
10,
0
]
}
}
}
} GeoJSON file example{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"height": 10,
"radius": 10,
"someOtherProp": "what"
},
"geometry": {
"type": "Point",
"coordinates": [
144.91734981536865,
-37.824700770115996
]
}
},
... |
Beta Was this translation helpful? Give feedback.
-
@nf-s, your examples work well in 3D view. However, after switching to 2D, labels become very small, blurry, and generally not readable. They don't seem to follow the spec from CZML. Is it a known issue? Is there any workaround (eg separate styles for 2d view)? |
Beta Was this translation helpful? Give feedback.
-
How can I display only labels for a marker? Like having a CSV input for coordinates of a city and displaying city name on top its marker?
Beta Was this translation helpful? Give feedback.
All reactions