Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom geoJson description function #3140

Closed
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
8fdea8a
Add back the show/hide functionality.
kring Jun 5, 2014
97458bc
Make loadWithXhr work in busted old browsers, sort of.
kring Jun 5, 2014
3ae9ab7
Add getFeatureInfo method to WebMapServiceImageryProvider.
kring Jun 10, 2014
c4f083e
Merge branch 'constructWithDataSources' into nm
kring Jun 10, 2014
cc5b241
Merge branch 'nullGeoJsonFeatureName' into nm
kring Jun 11, 2014
835b091
Merge remote-tracking branch 'origin/master' into nm
kring Jun 11, 2014
34b1181
Merge remote-tracking branch 'origin/ie9' into nm
kring Jun 13, 2014
44daa4b
Merge remote-tracking branch 'origin/kml' into nm
kring Jun 21, 2014
7f8608f
Fix combine task in build.xml.
kring Jun 24, 2014
5094cee
Merge branch 'kml-fix-combine' into nm
kring Jun 24, 2014
f74dc51
Merge remote-tracking branch 'origin/kml' into nm
kring Jun 24, 2014
1d4efaf
Merge branch 'viewerDeletesDataSourceCollection' into nm
kring Jun 26, 2014
c087a51
Add support for authenticated XHR.
kring Jul 3, 2014
fa4a66a
If WMS GetFeatureInfo can't do GeoJSON, return XML.
kring Jul 3, 2014
93b23ce
Fix Cesium bug that caused imagery textures to be applied twice.
kring Jul 7, 2014
b91ff20
Remove WMS.getFeatureInfo.
kring Jul 11, 2014
1c52461
Add the ability to refresh GeoJson descriptions.
kring Jul 13, 2014
f50ed2c
Merge remote-tracking branch 'origin/kml' into nm-merge
kring Jul 22, 2014
6f40527
Merge remote-tracking branch 'origin/master' into nm-merge
kring Jul 22, 2014
c6354fc
Give workers names when calling createTaskProcessorWorker.
kring Jul 28, 2014
8cc408a
Allow worker bootstrapper URL to be specified.
kring Jul 28, 2014
41b79f5
Add Globe.pickTriangle.
kring Jul 29, 2014
99e0a19
Return information about the picked tile, too.
kring Jul 29, 2014
e4ae3bc
Make createGeometry worker work with Browserify.
kring Jul 30, 2014
02bcc23
Revert unneeded changes.
kring Jul 30, 2014
9886314
Don't bomb on browsers lacking XHR.overrideMimeType (like IE10).
kring Jul 30, 2014
4d83eb3
More IE9 compatibility.
kring Jul 31, 2014
0de16c3
Merge branch 'nm2' into nm
kring Jul 31, 2014
5d5c34d
Merge tag '1.0' into nm
kring Aug 4, 2014
b0221d5
Merge remote-tracking branch 'origin/kml' into nm
kring Aug 4, 2014
ea58bd1
Remove changes that we no longer need.
kring Aug 8, 2014
6c92342
Merge branch 'tweaksFromNationalMap' into nm
kring Aug 8, 2014
e9e4910
Merge branch 'kml' into nm
kring Aug 8, 2014
f7251b7
Support both AMD and CommonJS requires in createGeometry.
kring Aug 8, 2014
bdc7700
Merge remote-tracking branch 'origin/kml' into nm
kring Aug 8, 2014
d1d8755
Fix SceneTransforms.wgs84ToWindowCoordinates for SCENE2D.
emackey Aug 6, 2014
b528611
Add unit tests, fix scene.morphTo* to work with unit tests.
emackey Aug 6, 2014
75df067
Use PolylineCollection for time-dynamic polylines
mramato Aug 7, 2014
82ba2ce
Update README.md
mramato Aug 7, 2014
fd0152d
Changes after review
mramato Aug 7, 2014
26b437d
Fix misspelling.
Aug 8, 2014
a52d956
Fix Matrix2 doc example.
mramato Aug 9, 2014
867a21c
Remove ancient remnant of the JSLint eclipse plugin.
shunter Aug 11, 2014
ff02ee9
Fix crash when material source uses Windows line endings.
shunter Aug 11, 2014
e6b6551
Fixes to sample code for Matrix2 and Matrix3 classes.
Aug 11, 2014
aa8e4be
Async picking of rasterized features in imagery layers.
kring Aug 11, 2014
3c2973b
Fix a couple bugs in SceneTransforms.wgs84To*Coordinates that didn't …
bagnell Aug 11, 2014
946f4d1
Show position of selected feature.
kring Aug 11, 2014
eee1e66
Update CHANGES.md
mramato Aug 11, 2014
03bf94a
If feature position is not known, use pick location.
kring Aug 11, 2014
fe8a138
Pick the front of the ellipsoid even below its max radius.
kring Aug 11, 2014
abc56b5
Use > instead of >=.
kring Aug 11, 2014
d69184b
Add support for MapInfo GetFeatureInfo.
kring Aug 11, 2014
50bb52e
Add support for Esri WMS servers.
kring Aug 11, 2014
7bec54e
Add support for unknown GetFeatureInfo responses.
kring Aug 11, 2014
077a1f0
Give user control over GetFeatureInfo format.
kring Aug 12, 2014
4e3f332
Add pickFeatures as an optional function on ImageryProvider.
kring Aug 12, 2014
cb2e047
Simplify layer feature picking and improve doc.
kring Aug 12, 2014
7849b58
pickImageryLayerFeatures specs, and fix typo.
kring Aug 13, 2014
868ad96
Add specs for Globe.pickImageryLayerFeatures.
kring Aug 13, 2014
136f85e
Handle ServiceExceptions by reporting "No Features".
kring Aug 13, 2014
6e8e9f1
Update CHANGES.md.
kring Aug 13, 2014
1a354c9
Fix jshint warning.
kring Aug 13, 2014
88d94e3
Merge remote-tracking branch 'origin/master' into nm
kring Aug 14, 2014
7c5682d
Fix bad merge.
kring Aug 14, 2014
40a1fa5
Merge remote-tracking branch 'origin/wmsImprovements' into nm
kring Aug 14, 2014
681343c
Merge remote-tracking branch 'kgrochow/esri-wkid' into nm
kring Sep 2, 2014
ce372f7
Merge remote-tracking branch 'kgrochow/esri-wkid' into nm
kring Sep 2, 2014
c7e5c89
Merge branch 'forEachLoadedTile' into nm
kring Sep 26, 2014
7a56229
Merge remote-tracking branch 'origin/master' into nm
kring Oct 8, 2014
e9b0bae
Add the ability to change the number of requests per server.
kring Oct 13, 2014
fa34714
Merge FeatureDetection.js from detectFirefox branch.
kring Oct 21, 2014
25f08da
Add Clock.clone.
kring Oct 23, 2014
154e745
Add the ability to specify the clock to Viewer.
kring Oct 24, 2014
f843ec7
Merge remote-tracking branch 'origin/master' into nm
kring Oct 24, 2014
b322645
Pass stride in pickTriangle function, too.
kring Oct 24, 2014
8c95897
Fix bug in processGroundOverlay.
kring Oct 27, 2014
3a56434
Add the ability to specify an SVG's fill-rule.
kring Dec 18, 2014
bfe2503
Don't bomb if picked feature has null geometry.
kring Jan 15, 2015
ee6f8e3
On busted browsers, make sure loadText loads text.
kring Jan 19, 2015
fa2b206
Merge remote-tracking branch 'origin/master' into kml
kring Jan 22, 2015
89ed1df
Merge branch 'kml' into nm
kring Jan 22, 2015
3de8fc6
Merge remote-tracking branch 'origin/correctMouseCoordinates' into nm
kring Jan 22, 2015
0dccdf9
Don't cancel document-level mousemove events.
kring Jan 22, 2015
b5f3956
Merge remote-tracking branch 'origin/correctMouseCoordinates' into nm
kring Jan 23, 2015
49167e2
Make loadXML work in IE10.
kring Jan 27, 2015
ff706f3
Merge remote-tracking branch 'origin/master' into nm
kring Jan 29, 2015
9a13cc6
Merge remote-tracking branch 'origin/headingDownUnder' into nm
kring Jan 29, 2015
cfc32a7
Workaround issue in Firefox 35
mramato Jan 28, 2015
0c3c226
Add FeatureDetection.isWindows
mramato Jan 29, 2015
3fad138
Reverts changes from #2408 and #2417. Adds an option to ScreenSpaceEv…
bagnell Jan 29, 2015
5f98c2c
Update CHANGES.md.
bagnell Jan 29, 2015
e1361e0
Revert remaining changes.
bagnell Jan 29, 2015
1ff54cb
Merge remote-tracking branch 'origin/master' into nm
kring Jan 29, 2015
b063f8d
Merge remote-tracking branch 'origin/headingDownUnder' into nm
kring Feb 2, 2015
1052475
Handle XML parsing errors on old browsers.
kring Feb 2, 2015
d6095c2
Fix jshint warning.
kring Feb 2, 2015
75dbcfa
Pass through HTTP status info on tile request failures.
kring Feb 5, 2015
aed4427
Fix an imagery loading bug.
kring Feb 10, 2015
7419287
Merge remote-tracking branch 'origin/master' into nm
kring Feb 12, 2015
c7677a4
Merge remote-tracking branch 'origin/kml' into nm
kring Feb 24, 2015
a8a5205
Add ability to specify content type to WMS GetFeatureInfo.
kring Feb 26, 2015
6fac93a
Handle GML GetFeatureInfo responses.
kring Feb 26, 2015
8f0f567
Always use user-specified XML content type, not just sometimes.
kring Feb 26, 2015
7d72cd1
Remove duplicate pickFeatures function
kring Feb 26, 2015
f8293f4
Fix erroneous counting of tiles waiting for children.
kring Mar 2, 2015
2cadccf
Add ability to specific limited layers in a MapServer.
kring Mar 13, 2015
8fb9b49
Add ArcGIS MapServer picking support.
kring Mar 13, 2015
99786f0
Improve flexibility of MapServer provider.
kring Mar 13, 2015
8edf6de
Allow specify tile width/height to ArcGisMapServerImageryProvider.
kring Mar 18, 2015
bef4724
Include properties on ImageryLayerFeatureInfo.
kring Mar 19, 2015
d3ce97e
Handle web mercator points.
kring Mar 31, 2015
cc5ec1e
Merge tag '1.8' into nm
kring Apr 2, 2015
7337cd2
Remove redundant doc.
kring Apr 2, 2015
b040a3f
Remove unnecessary modifications.
kring Apr 2, 2015
da5ee9b
Add browserify deamdify transform.
kring Apr 9, 2015
6132dcf
Add ability to set maxLevel for ArcGisMapServerImageryProvider.
kring Apr 14, 2015
1218a66
Improve doc of maximumLevel property.
kring Apr 15, 2015
a765cb0
Remove Browserify transform from package.json.
kring Apr 15, 2015
a8444ed
Copy .gitignore to .npmignore and modify it.
kring Apr 16, 2015
041f715
Only pick features from the intended layers.
kring Apr 16, 2015
86375d9
Support KML documents using explicit namespacing.
kring Apr 17, 2015
b06bb40
Make Cesium into an npm module.
kring Apr 24, 2015
4d2d363
Bump to v0.0.4.
kring Apr 24, 2015
6a14160
Don't generateMipMaps if texture is NPOT.
kring Apr 24, 2015
f08c5d4
Bump version to 0.0.5.
kring Apr 24, 2015
0891ca5
Merge remote-tracking branch 'upstream/master' into cesiumUpgrade
kring Apr 27, 2015
0552de1
prepare-cesium in postinstall, if necessary.
kring Apr 28, 2015
4c8a5e0
Merge remote-tracking branch 'upstream/master' into cesiumUpgrade
kring Apr 28, 2015
4d1a4ab
Merge pull request #1 from TerriaJS/cesiumUpgrade
kring Apr 28, 2015
81f6c87
Bump to v1.8.1.
kring Apr 28, 2015
af553a9
Match Cesium's version number, plus some metadata.
kring Apr 28, 2015
0481757
Remove build metadata from version.
kring Apr 28, 2015
decc316
Minor improvements.
kring Apr 29, 2015
e8d6645
Make WMS 1.3.0 GetCapabilities work in busted IE9.
kring Apr 29, 2015
0e990d3
Prefix terriajs-cesium version numbers.
kring Apr 29, 2015
c77ad23
Bump version.
kring Apr 29, 2015
824ba8f
Merge remote-tracking branch 'upstream/nm' into terriajs
kring Apr 29, 2015
ce42b41
Bump version.
kring Apr 29, 2015
c1be1fe
Make npm scripts work on Windows.
kring Apr 29, 2015
a4986bb
Bump version.
kring Apr 29, 2015
7d4db64
Imagery picking improvements.
kring May 11, 2015
a3b8a03
Bump version.
kring May 11, 2015
88107db
Correctly handle getFeatureInfoFormats parameter.
kring May 11, 2015
e90cbd4
Improve handling of HTML GetFeatureInfo responses.
kring May 12, 2015
9d25a7d
Bump version.
kring May 12, 2015
fc6e0f0
Fix deprectation message.
kring May 13, 2015
bccc06b
Remove unnecessary code changes.
kring May 14, 2015
3bf997d
Bump version number.
kring May 15, 2015
0b38ed2
Don't fail completely in IE8.
kring May 28, 2015
bceb4b5
Bump version.
kring May 28, 2015
95c8136
Better algorithm for choosing rectangle center.
kring May 28, 2015
b852f2e
Bump version.
kring May 28, 2015
a49000a
Merge tag '1.10' of github.com:AnalyticalGraphicsInc/cesium into terr…
kring Jun 2, 2015
a950a46
Revert unnecessary changes.
kring Jun 2, 2015
3570407
Merge branch 'viewRectangle' into terriajs
kring Jun 3, 2015
f461dbe
Bump version number.
kring Jun 3, 2015
54b1a1b
Merge branch 'viewRectangle' into terriajs
kring Jun 3, 2015
a43f1d1
relaxed namespaceUri matching for wms servers
Jun 4, 2015
1164e00
Add timeout option to loadWithXhr.
kring Jun 4, 2015
b723765
remove namespace check for featureinfo
Jun 4, 2015
abb268b
Merge branch 'terriajs' of https://github.com/TerriaJS/cesium into te…
Jun 4, 2015
0dd7a63
Bump version.
kring Jun 4, 2015
6cf2291
Fix IE9 breakage.
kring Jun 5, 2015
86aa691
Add support for WMTS GetFeatureInfo.
kring Jun 9, 2015
8469b53
Bump version.
kring Jun 9, 2015
cb9a9b6
ArcGisMapServerImageryProvider improvements.
kring Jun 10, 2015
397b8cf
Bump version.
kring Jun 10, 2015
97107d6
Fix crash in Scene.destroy on IE11.
kring Jun 10, 2015
353e380
Bump version.
kring Jun 10, 2015
0bc1d9e
Don't crash at module load time in IE8.
kring Jun 23, 2015
c940452
Bump version.
kring Jun 23, 2015
3cf2c60
Take two at fixing IE8.
kring Jun 23, 2015
0c8a232
Bump version.
kring Jun 23, 2015
c695086
Merge tag '1.11' into terriajs
kring Jul 8, 2015
43e42b0
Support an array of subdomains to prepend to tiles, for performance.
stevage Jul 14, 2015
10cec10
Merge pull request #2 from TerriaJS/osm-subdomains
kring Jul 14, 2015
d0ceeb3
Bump version.
kring Jul 15, 2015
50f28cc
Sync with official Cesium 1.13.
kring Sep 21, 2015
e73b415
Upgrade to Cesium 1.14.
kring Oct 13, 2015
4789bce
image layer to feature
chloeleichen Oct 12, 2015
69f184b
fix test
chloeleichen Oct 12, 2015
c9753eb
add image layer
chloeleichen Oct 12, 2015
89908a5
Bump version.
kring Oct 14, 2015
61d653b
allow custom description of geojson properties
RacingTadpole Oct 28, 2015
3c4072f
use load options to specify geoJson describe function
RacingTadpole Oct 28, 2015
ab4ef37
improve jsdoc desc
RacingTadpole Oct 28, 2015
fd85cfc
add spec for geojson custom description
RacingTadpole Oct 28, 2015
c16b4af
add to contributors, changes
RacingTadpole Oct 28, 2015
04007eb
fix jshint
RacingTadpole Oct 28, 2015
8561ac6
Merge tag '1.15' into cesiumUpgrade-1.15
kring Nov 2, 2015
e1315aa
Fix merge conflicts.
kring Nov 2, 2015
d0856b4
Remove commented-out code.
kring Nov 2, 2015
f818342
Merge pull request #3 from TerriaJS/cesiumUpgrade-1.15
kring Nov 2, 2015
fdc47c3
use describeProperty instead of describe
RacingTadpole Nov 4, 2015
a1e9e58
update changes
RacingTadpole Nov 4, 2015
5be758a
use describe again
RacingTadpole Nov 4, 2015
a9ee5e0
improve jsdoc, add test
RacingTadpole Nov 4, 2015
b04e2f2
fix jsdoc so that properties is an Object
RacingTadpole Nov 4, 2015
056314c
remove old change desc
RacingTadpole Nov 4, 2015
804bedf
Merge pull request #5 from TerriaJS/upstream_geojson_description
kring Nov 5, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Change Log
* Updated `requirejs` from 2.1.9 to 2.1.20. [#3107](https://github.com/AnalyticalGraphicsInc/cesium/pull/3107)
* Updated `almond` from 0.2.6 to 0.3.1. [#3107](https://github.com/AnalyticalGraphicsInc/cesium/pull/3107)
* Made `TileMapServiceImageryProvider` and `CesiumTerrainProvider` work properly when the provided base url contains query parameters and fragments.
* Allow custom geoJson description function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be moved to a 1.16 section. I would also be more specific, something like:

GeoJsonDataSource.load now takes an optional describe function for generating feature descriptions. #3140


### 1.14 - 2015-10-01

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Kevin Ring](https://github.com/kring)
* [Keith Grochow](https://github.com/kgrochow)
* [Chloe Chen](https://github.com/chloeleichen)
* [Arthur Street](https://github.com/RacingTadpole)
* [EU Edge](http://euedge.com/)
* [Ákos Maróy](https://github.com/akosmaroy)
* [Raytheon Intelligence and Information Systems](http://www.raytheon.com/)
Expand Down
21 changes: 12 additions & 9 deletions Source/DataSources/GeoJsonDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ define([

var stringifyScratch = new Array(4);

function describe(properties, nameProperty) {
function defaultDescribe(properties, nameProperty) {
var html = '';
for ( var key in properties) {
if (properties.hasOwnProperty(key)) {
Expand All @@ -99,7 +99,7 @@ define([
var value = properties[key];
if (definedNotNull(value)) {
if (typeof value === 'object') {
html += '<tr><th>' + key + '</th><td>' + describe(value) + '</td></tr>';
html += '<tr><th>' + key + '</th><td>' + defaultDescribe(value) + '</td></tr>';
} else {
html += '<tr><th>' + key + '</th><td>' + value + '</td></tr>';
}
Expand All @@ -114,7 +114,7 @@ define([
return html;
}

function createDescriptionCallback(properties, nameProperty) {
function createDescriptionCallback(describe, properties, nameProperty) {
var description;
return function(time, result) {
if (!defined(description)) {
Expand All @@ -127,7 +127,7 @@ define([
//GeoJSON specifies only the Feature object has a usable id property
//But since "multi" geometries create multiple entity,
//we can't use it for them either.
function createObject(geoJson, entityCollection) {
function createObject(geoJson, entityCollection, describe) {
var id = geoJson.id;
if (!definedNotNull(id) || geoJson.type !== 'Feature') {
id = createGuid();
Expand Down Expand Up @@ -189,7 +189,7 @@ define([

var description = properties.description;
if (!defined(description)) {
entity.description = new CallbackProperty(createDescriptionCallback(properties, nameProperty), true);
entity.description = new CallbackProperty(createDescriptionCallback(describe, properties, nameProperty), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to have the provided describe return a Property instance and be called instead of creating a CallbackProperty every time? It's almost the same as you have now, but I think it would be more flexible. For example, the way this is currently set up, there's no good way (as far as I can tell) to supply an asynchronous describe function, but if you could return a custom property, that would be easy. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that sounds more flexible - you could even gain flexibility over the nameProperty calculation then too.

I could change line 192 to read something like (with appropriate checks and balances):

entity.description = options.describeProperty(properties, nameProperty)

Then the user would define their custom describe function, and call load with options.describeProperty =

function(properties, nameProperty) {
    return new CallbackProperty(createDescriptionCallback(describe, properties, nameProperty), true);
}

Have I understood you right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's exactly what I had in mind. Also, due to the automatic wrapping/coercion we do for simple types, they can also return a single string back instead of a Property instance and everything will still work.

} else if (description !== null) {
entity.description = new ConstantProperty(description);
}
Expand All @@ -213,7 +213,7 @@ define([

if (feature.geometry === null) {
//Null geometry is allowed, so just create an empty entity instance for it.
createObject(feature, dataSource._entityCollection);
createObject(feature, dataSource._entityCollection, options.describe);
} else {
var geometryType = feature.geometry.type;
var geometryHandler = geometryTypes[geometryType];
Expand Down Expand Up @@ -284,7 +284,7 @@ define([
billboard.verticalOrigin = new ConstantProperty(VerticalOrigin.BOTTOM);
billboard.image = new ConstantProperty(dataUrl);

var entity = createObject(geoJson, dataSource._entityCollection);
var entity = createObject(geoJson, dataSource._entityCollection, options.describe);
entity.billboard = billboard;
entity.position = new ConstantPositionProperty(crsFunction(coordinates));
}));
Expand Down Expand Up @@ -334,7 +334,7 @@ define([
polyline.width = widthProperty;
polyline.positions = new ConstantProperty(coordinatesArrayToCartesianArray(coordinates, crsFunction));

var entity = createObject(geoJson, dataSource._entityCollection);
var entity = createObject(geoJson, dataSource._entityCollection, options.describe);
entity.polyline = polyline;
}

Expand Down Expand Up @@ -417,7 +417,7 @@ define([
polygon.perPositionHeight = new ConstantProperty(true);
}

var entity = createObject(geoJson, dataSource._entityCollection);
var entity = createObject(geoJson, dataSource._entityCollection, options.describe);
entity.polygon = polygon;
}

Expand Down Expand Up @@ -732,6 +732,8 @@ define([
* @param {String|Object} data A url, GeoJSON object, or TopoJSON object to be loaded.
* @param {Object} [options] An object with the following properties:
* @param {String} [options.sourceUri] Overrides the url to use for resolving relative links.
* @param {Function} [options.describe=GeoJsonDataSource.defaultDescribe] A custom function used to convert the properties into an html description.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than using Function here, jsDoc allows us to define callback signatures. See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/DataSources/CallbackProperty.js#L108 for an example.

* It takes two arguments: the properties and a nameProperty.
* @param {Number} [options.markerSize=GeoJsonDataSource.markerSize] The default size of the map pin created for each point, in pixels.
* @param {String} [options.markerSymbol=GeoJsonDataSource.markerSymbol] The default symbol of the map pin created for each point.
* @param {Color} [options.markerColor=GeoJsonDataSource.markerColor] The default color of the map pin created for each point.
Expand Down Expand Up @@ -761,6 +763,7 @@ define([
}

options = {
describe: defaultValue(options.describe, defaultDescribe),
markerSize : defaultValue(options.markerSize, defaultMarkerSize),
markerSymbol : defaultValue(options.markerSymbol, defaultMarkerSymbol),
markerColor : defaultValue(options.markerColor, defaultMarkerColor),
Expand Down
39 changes: 38 additions & 1 deletion Specs/DataSources/GeoJsonDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ defineSuite([
});
});

it('Creates description from properties', function() {
it('Creates default description from properties', function() {
var featureWithProperties = {
type : 'Feature',
geometry : point,
Expand All @@ -296,6 +296,43 @@ defineSuite([
});
});

it('Creates custom description from properties', function() {
var featureWithProperties = {
type : 'Feature',
geometry : point,
properties : {
prop1 : 'dog',
prop2 : 'cat',
prop3 : 'liger'
}
};

function testDescribe(properties) {
var desc = '';
for (var key in properties) {
if (properties.hasOwnProperty(key)) {
var value = properties[key];
desc += key + ' = ' + value + '. ';
}
}
return desc;
}

var dataSource = new GeoJsonDataSource();
var options = {
describe: testDescribe
};
return dataSource.load(featureWithProperties, options).then(function() {
var entityCollection = dataSource.entities;
var entity = entityCollection.values[0];
expect(entity.description).toBeDefined();
var description = entity.description.getValue(time);
expect(description).toContain('prop1 = dog');
expect(description).toContain('prop2 = cat');
expect(description).toContain('prop3 = liger');
});
});

it('Uses description if present', function() {
var featureWithDescription = {
type : 'Feature',
Expand Down