Opened 9 years ago
Last modified 6 months ago
#10474 new enhancement
Scaling of fill-image
Reported by: | Owned by: | team | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core mappaint | Version: | tested |
Keywords: | mapcss | Cc: |
Description
I have previously prosted this request on http://wiki.openstreetmap.org/wiki/MapCSS/0.2 talk-page
It would be nice to have the ability to scale fill-image, often the suitable fill-images are of the wrong size, and I would like to be able to re-utilize the same source image file over several paint conditions. IMO it is bad custom generating 8x8px, 12x12px, 16x16px, 24x24px and 32x32px versions of the same image when a simple fill-image-size, fill-image-height or fill-image-width could solve it
As you see from the error message I use .svg images (that error is from an experimental/under development style)
Repository Root: http://josm.openstreetmap.de/svn Build-Date: 2014-08-31 21:55:55 Last Changed Author: Don-vip Revision: 7480 Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b URL: http://josm.openstreetmap.de/svn/trunk Last Changed Date: 2014-08-31 23:51:24 +0200 (Sun, 31 Aug 2014) Last Changed Rev: 7480 Identification: JOSM/1.5 (7480 en) Mac OS X 10.9.4 Memory Usage: 451 MB / 910 MB (81 MB allocated, but free) Java version: 1.7.0_67, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM VM arguments: [-Djava.library.path=/Applications/JOSM.app/Contents/MacOS, -DLibraryDirectory=/Users/skippern/Library, -DDocumentsDirectory=/Users/skippern/Documents, -DApplicationSupportDirectory=/Users/skippern/Library/Application Support, -DCachesDirectory=/Users/skippern/Library/Caches, -DSandboxEnabled=false, -Dapple.laf.useScreenMenuBar=true, -Dcom.apple.macos.use-file-dialog-packages=true, -Dcom.apple.macos.useScreenMenuBar=true, -Dcom.apple.mrj.application.apple.menu.about.name=JOSM, -Dcom.apple.smallTabs=true] Dataset consistency test: No problems found Plugins: - PicLayer (30436) - SeaMapEditor (30475) - continuosDownload (28565) - dataimport (30416) - geotools (30569) - jts (30416) - mirrored_download (30495) - notes (v0.9.4) - opendata (30607) - reverter (30521) - turnlanes (30416) - turnrestrictions (30454) - utilsplugin2 (30460) Last errors/warnings: - E: Failed to locate image 'https://raw.githubusercontent.com/Skippern/INT-1/master/SVG/Q/super-buoy/;.svg' - E: Failed to locate image 'https://raw.githubusercontent.com/Skippern/INT-1/master/SVG/Q/super-buoy/;.svg' - E: Failed to locate image 'https://raw.githubusercontent.com/Skippern/INT-1/master/SVG/Q/super-buoy/;.svg' - E: org.openstreetmap.josm.data.osm.DataIntegrityProblemException: Primitive must be part of the dataset: {Node id=-11095 version=0 VT lat=0.0,lon=0.0} - E: org.openstreetmap.josm.data.osm.DataIntegrityProblemException: Primitive must be part of the dataset: {Node id=-11096 version=0 VT lat=0.0,lon=0.0}
Attachments (0)
Change History (4)
comment:1 follow-up: 2 Changed 6 months ago by
comment:2 Changed 6 months ago by
(I'm not Aun)
@josail: It would help to have a sample file for the problem.
With that said, I would recommend reading DevelopersGuide/DefaultPresets#NewIcons.
I think the big things are:
- The base size of svg should be 16px or larger than 64px. Images with a base size between 16 and 64 px will not be scaled down to 16px.
- Resize your icon to 16px or an integer multiple size of it (not something like 458.1534) to avoid display inaccuracies due to rounding errors within java.
- Check the code of the file in a text editor. Search for viewBox value in the beginning of the file. If the icon is, for example, in 16x16 pixels, and if you made it in Inkscape (at least this happens in 0.91 version) and have defined in Document Properties 16,00000 by 16,00000 pixels, probably in the file code you have these values viewBox="0 0 16.000002 16.000001". Change it to viewBox="0 0 16 16" or you will have problems (see #12201 and the fix [o31865])
comment:3 Changed 6 months ago by
Thanks for the fast reply, I like to respond as well and send the two files, that I like to use as fill images for seaweed and seagrass. Thanks for any further hint. Jo
https://github.com/osmandapp/OsmAnd-resources/blob/master/icons/svg/shaders_int1/h_seamark_j132_weedkelp_shader.svg
https://github.com/osmandapp/OsmAnd-resources/blob/master/icons/svg/shaders_int1/h_seamark_j134_seagrass_shader.svg
comment:4 Changed 6 months ago by
The base size of svg should be 16px or larger than 64px. Images with a base size between 16 and 64 px will not be scaled down to 16px.
Looking at the images posted,
<svg width="32" height="32" [...snip...] viewBox="0 0 32 32" [...snip...]>
You need to either increase the base size to 64px or decrease it to 16px.
Aun, did you find a solution on this one? I have the same problem now in the INT-1 MapCSS for JOSM