Commits

tbrugz  committed f775a10

added example: Brazil_Labelled_Map_v2.svg ; +small changes

  • Participants
  • Parent commits 406ab35

Comments (0)

Files changed (8)

 
 svg2kml howto:
 - build with ant
+- copy svg2kml.properties.template to svg2kml.properties
 - edit svg2kml.properties, set "svgin", "kmlout", "maxX", "minX", "maxY", "minY" properties
 - (optional) edit snippets.properties to set constant parts to be inserted in the KML file
 - (optional) edit idmappings.properties to translate IDs from the SVG file to the KML file
 - commons-logging (included)
 - ant (not included - build only)
 
-Municipalities_of_RS.svg originated from:
-http://commons.wikimedia.org/wiki/File:Municipalities_of_the_South_Region_of_Brazil.svg
-licensed under: http://creativecommons.org/licenses/by-sa/3.0/deed.en
 
-SantaCatarina_MesoMicroMunicip_municipios.svg originated from:
-http://commons.wikimedia.org/wiki/File:SantaCatarina_MesoMicroMunicip.svg
-licensed under: http://creativecommons.org/licenses/by-sa/3.0/deed.en
-
-KML Schema - urls:
-http://schemas.opengis.net/kml/2.2.0/
-http://code.google.com/intl/pt-BR/apis/kml/schema/kml21.xsd
-
-
-running - classes with main()
+Running - classes with main()
 -----------------------------
 - tbrugz.geo.SVG2KML (main)
 - tbrugz.geo.test.Test
 - tbrugz.xml.test.Test
 
 
-specs...
+Included media
+--------------
+  
+Municipalities_of_RS.svg originated from:
+http://commons.wikimedia.org/wiki/File:Municipalities_of_the_South_Region_of_Brazil.svg
+licensed under: http://creativecommons.org/licenses/by-sa/3.0/
+
+SantaCatarina_MesoMicroMunicip_municipios.svg originated from:
+http://commons.wikimedia.org/wiki/File:SantaCatarina_MesoMicroMunicip.svg
+licensed under: http://creativecommons.org/licenses/by-sa/3.0/
+
+Brazil_Labelled_Map_v2.svg originated from:
+http://pt.wikipedia.org/wiki/Ficheiro:Brazil_Labelled_Map.svg
+licensed under: http://creativecommons.org/licenses/by-sa/3.0/
+
+
+KML Schema - urls
+-----------------
+http://schemas.opengis.net/kml/2.2.0/
+http://code.google.com/intl/pt-BR/apis/kml/schema/kml21.xsd
+
+
+Specs...
 --------
 http://code.google.com/intl/en/apis/kml/documentation/kml_tut.html
 http://code.google.com/intl/en/apis/kml/documentation/kmlreference.html
 http://www.w3.org/TR/SVG/paths.html
 
 
-changelog?
----------
+Changelog?
+----------
 see: https://bitbucket.org/tbrugz/kmlutils/changesets

File src/tbrugz/graphml/DumpGraphMLModel.java

 	
 	public String getSnippetId(Stereotyped st, String s) {
 		if(st.getStereotype()!=null) {
-			String news = s+"."+st.getStereotype();
-			if(hasSnippet(news)) { return news; }
+			String newS = s+"."+st.getStereotype();
+			while(true) {
+				if(hasSnippet(newS)) { return newS; }
+				int index = newS.lastIndexOf(".");
+				if(index<=0) { break; }
+				newS = newS.substring(0, index);
+			}
 		}
 		return s;
 	}

File src/tbrugz/graphml/model/Node.java

 	String label;
 	boolean initialNode;
 	boolean finalNode;
+	String stereotype;
 	
 	//List<Link> prox = new ArrayList<Link>();
 	
 	}
 
 	public String getStereotype() {
-		return null;
+		return stereotype;
 	}
 
-	public void setStereotype(String s) {}
+	public void setStereotype(String stereotype) {
+		this.stereotype = stereotype;
+	}
 
 	public String getStereotypeParam(int i) {
 		return null;

File src/tbrugz/svg/parser/SVGParser.java

 
 			if(state==2) {
 				token = sr.readNumbers();
-				point.y = Float.parseFloat(token);
+				try {
+					point.y = Float.parseFloat(token);
+				}
+				catch(NullPointerException e) {
+					log.warn("not a float: "+token);
+					e.printStackTrace();
+				}
 				Point newPoint = (Point)point.clone();
 				if(!absoluteRef) {
 					if(previousPoint==null) {

File svg2kml-brstates.properties

+# maxX, minX, maxY and minY will be the bounds of the resulting KML files. svg2kml uses this values to convert
+# the points from the svg files into latitude/longitude points in the kml file
+
+# east
+svg2kml.maxX=-38.2
+# west
+svg2kml.minX=-76.02
+
+# inverting maxY with minY inverts the vertical orientation of the KML, which is the desired effect, 
+# since SVG and KML have opposite vertical orientations
+
+# south
+svg2kml.maxY=-29.985
+# north
+svg2kml.minY=6.61
+
+# the input SVG file to read from
+svg2kml.svgin=work/input/Brazil_Labelled_Map_v2.svg
+
+# prop file with id mappings (optional)
+svg2kml.idmappingsprop=work/input/idmappings.properties
+
+# the output KML file to write to
+svg2kml.kmlout=work/output/Brazil_Labelled_Map.kml

File svg2kml.properties

-# maxX, minX, maxY and minY will be the bounds of the resulting KML files. svg2kml uses this values to convert
-# the points from the svg files into latitude/longitude points in the kml file
-svg2kml.maxX=-49.6917
-svg2kml.minX=-57.64777
-
-# inverting maxY with minY inverts the vertical orientation of the KML, which is the desired effect, 
-# since SVG and KML have opposite vertical orientations
-svg2kml.maxY=-33.7515
-svg2kml.minY=-27.08
-
-# the input SVG file to read from
-svg2kml.svgin=work/input/Municipalities_of_RS.svg
-
-# prop file with id mappings (optional)
-svg2kml.idmappingsprop=work/input/idmappings.properties
-
-# the output KML file to write to
-svg2kml.kmlout=work/output/Municipalities_of_RS.kml

File svg2kml.properties.template

+# maxX, minX, maxY and minY will be the bounds of the resulting KML files. svg2kml uses this values to convert
+# the points from the svg files into latitude/longitude points in the kml file
+
+# east
+svg2kml.maxX=-49.6917
+# west
+svg2kml.minX=-57.64777
+
+# inverting maxY with minY inverts the vertical orientation of the KML, which is the desired effect, 
+# since SVG and KML have opposite vertical orientations
+
+# south
+svg2kml.maxY=-33.7515
+# north
+svg2kml.minY=-27.08
+
+# the input SVG file to read from
+svg2kml.svgin=work/input/Municipalities_of_RS.svg
+
+# prop file with id mappings (optional)
+svg2kml.idmappingsprop=work/input/idmappings.properties
+
+# the output KML file to write to
+svg2kml.kmlout=work/output/Municipalities_of_RS.kml

File work/input/Brazil_Labelled_Map_v2.svg

Added
New image