5


i'm trying to use svg-android to display a road map i exported from openstreetmap.
I follow the steps from the tutorial and it worked great with a test.svg graphic (3KB). But the exported map is arround 500KB. When i try to load the map i get an SVGParseException:

System.err: com.larvalabs.svgandroid.SVGParseException: java.lang.NumberFormatException
System.err:     at com.larvalabs.svgandroid.SVGParser.parse(Unknown Source)
System.err:     at com.larvalabs.svgandroid.SVGParser.getSVGFromResource(Unknown Source)
System.err:     at my.package.view.SVGMapView.loadSVGImage(SVGMapView.java:141)

line 141 says:

svg = SVGParser.getSVGFromResource(getResources(), R.raw.test);

is there a possibility to preload the svg image in an extra thread, or is there a better solution for my problem?

thanks

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
t0mM3k
  • 51
  • 1
  • 2
  • i'm not shore about these but it can be the resolution of your image try to make it odd like 256 X 256 sorry my english @t0mM3k – PedroAGSantos Jul 11 '11 at 14:19
  • hey subspider, thanks for your answer, but i'm talking about svg-graphics (scalable vector graphics). so they don't have a resolution to change. – t0mM3k Jul 12 '11 at 06:20
  • oh okay, now i understood what you meant. but its not working :-(
    I watched in the logging, and the Parser says all the time: UNRECOGNIZED SVG COMMAND: symbol
    – t0mM3k Jul 12 '11 at 09:17

1 Answers1

6

What is happening in this case is that the svg library for Android is quite limited, in that it doesn't support the full SVG spec. The map you saved includes some features that svg-android simply can't manage. Unfortunately, there isn't a whole lot you can do about it, except to try a different format.

Threading would not make the problem any better, incidentally. This would make the loading of the image happen in the background, but it would not fix the fundamental problem, that the SVG file simply contains things that can't be parsed.

What you can try is to load the file via an offline SVG tool, and re-save it with the required format, SVG Basic 1.1.

PearsonArtPhoto
  • 38,970
  • 17
  • 111
  • 142