Always force flatProperties in osmtogeojson call

fix #641

See https://github.com/tyrasd/osmtogeojson/issues/100
This commit is contained in:
Yohan Boniface 2018-09-22 07:33:00 +02:00
parent 81830f8f7b
commit e1844483d7
2 changed files with 15 additions and 1 deletions

View file

@ -505,7 +505,7 @@ L.U.DataLayer = L.Evented.extend({
} catch (e) {
d = toDom(c);
}
callback(osmtogeojson(d));
callback(osmtogeojson(d, {flatProperties: true}));
} else if (type === 'geojson') {
try {
var gj = JSON.parse(c);

View file

@ -144,6 +144,20 @@ describe('L.U.Map', function(){
assert.equal(this.datalayer._index.length, 2);
});
it('should import osm from textarea', function () {
this.datalayer.empty()
happen.click(qs('a.upload-data'));
textarea = qs('.umap-upload textarea');
submit = qs('.umap-upload input[type="button"]');
formatSelect = qs('.umap-upload select[name="format"]');
assert.equal(this.datalayer._index.length, 0);
textarea.value = '{"version": 0.6,"generator": "Overpass API 0.7.55.4 3079d8ea","osm3s": {"timestamp_osm_base": "2018-09-22T05:26:02Z","copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."},"elements": [{"type": "node","id": 3619112991,"lat": 48.9352995,"lon": 2.3570684,"tags": {"information": "map","map_size": "city","map_type": "scheme","tourism": "information"}},{"type": "node","id": 3682500756,"lat": 48.9804426,"lon": 2.2719725,"tags": {"information": "map","level": "0","tourism": "information"}}]}';
changeSelectValue(formatSelect, 'osm');
happen.click(submit);
assert.equal(this.datalayer._index.length, 2);
assert.equal(this.datalayer._layers[this.datalayer._index[0]].properties.tourism, 'information');
});
it('should import kml from textarea', function () {
this.datalayer.empty()
happen.click(qs('a.upload-data'));