umap-project / umap

uMap lets you create maps with OpenStreetMap layers in a minute and embed them in your site.
https://umap-project.org
Other
1.13k stars 216 forks source link

Newline in placeholder #295

Open cascafico opened 8 years ago

cascafico commented 8 years ago

Bonjour,

How can I include newlines?

Example, not working:

{name} contains "amenity=bar\nrestaurant=yes"

I'd like popup like this:

amenity=bar restaurant=yes

yohanboniface commented 8 years ago

Have you tried to change the popup template?

cascafico commented 8 years ago

I was trying to pass "\n" from an imported csv. Now I imported data as geojson and it is correctly interpreted in popoup [1].

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
 "features": [
{ "type": "Feature", "properties": { "HANDICAPS": "auditif\nmental" }, "geometry": { "type": "Point", "coordinates": [ 5.535133, 45.90137 ] } }
]
}

What still happens is that once I display table, "\n" is gone (ie: I read "auditifmental"), but newline is still interpreted in popup.

[1] http://umap.openstreetmap.fr/en/map/untitled-map_76315

nrenner commented 5 years ago

It works if the CSV field contains actual line breaks (not "\n") and is enclosed in double quotation marks:

HANDICAPS,lon,lat
"auditif
mental",10.0,51.0

uMap uses csv2geojson, that again uses d3-dsv, that implements RFC 4180 (Common Format and MIME Type for CSV Files). It defines:

   6.  Fields containing line breaks (CRLF), double quotes, and commas
       should be enclosed in double-quotes.  For example:

       "aaa","b CRLF
       bb","ccc" CRLF
       zzz,yyy,xxx