da strawberryfield » 3 ott 2011, 22:46
da strawberryfield » 5 ott 2011, 22:57
Codice: Seleziona tutto
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>Ippodromo.kml</name>
<StyleMap id="msn_ylw-pushpin">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_ylw-pushpin</styleUrl>
</Pair>
</StyleMap>
<Style id="sn_ylw-pushpin">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<StyleMap id="msn_ylw-pushpin0">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin2</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_ylw-pushpin1</styleUrl>
</Pair>
</StyleMap>
<Style id="sn_ylw-pushpin0">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<StyleMap id="msn_ylw-pushpin1">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin1</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_ylw-pushpin0</styleUrl>
</Pair>
</StyleMap>
<Style id="sn_ylw-pushpin1">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Style id="sh_ylw-pushpin">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Style id="sh_ylw-pushpin0">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Style id="sh_ylw-pushpin1">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Style id="sh_ylw-pushpin2">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<StyleMap id="msn_ylw-pushpin2">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin0</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_ylw-pushpin2</styleUrl>
</Pair>
</StyleMap>
<Style id="sn_ylw-pushpin2">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Folder>
<name>Ippodromo</name>
<open>1</open>
<description>Ippodromo di Cesena</description>
<Style>
<ListStyle>
<listItemType>check</listItemType>
<bgColor>00ffffff</bgColor>
<maxSnippetLines>2</maxSnippetLines>
</ListStyle>
</Style>
<Placemark>
<name>Arrivo</name>
<LookAt>
<longitude>12.23210010083588</longitude>
<latitude>44.14433663138394</latitude>
<altitude>0</altitude>
<heading>0.003276226120089498</heading>
<tilt>0.04373104733540818</tilt>
<range>244.7399320508613</range>
<altitudeMode>relativeToGround</altitudeMode>
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
</LookAt>
<styleUrl>#msn_ylw-pushpin</styleUrl>
<Point>
<altitudeMode>clampToGround</altitudeMode>
<gx:altitudeMode>clampToSeaFloor</gx:altitudeMode>
<coordinates>12.23207537755476,44.14382792157764,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Arrivo lato tribuna</name>
<LookAt>
<longitude>12.23213902287877</longitude>
<latitude>44.1443163185978</latitude>
<altitude>0</altitude>
<heading>2.710809129418501e-005</heading>
<tilt>0</tilt>
<range>244.6536947408126</range>
<altitudeMode>relativeToGround</altitudeMode>
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
</LookAt>
<styleUrl>#msn_ylw-pushpin1</styleUrl>
<Point>
<altitudeMode>clampToGround</altitudeMode>
<gx:altitudeMode>clampToSeaFloor</gx:altitudeMode>
<coordinates>12.23199815503766,44.14361377111013,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>per calcolo inclinazione</name>
<LookAt>
<longitude>12.23155379868458</longitude>
<latitude>44.14397818208246</latitude>
<altitude>0</altitude>
<heading>14.05818530502537</heading>
<tilt>0</tilt>
<range>402.7257460440399</range>
<altitudeMode>relativeToGround</altitudeMode>
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
</LookAt>
<styleUrl>#msn_ylw-pushpin2</styleUrl>
<Point>
<altitudeMode>clampToGround</altitudeMode>
<gx:altitudeMode>clampToSeaFloor</gx:altitudeMode>
<coordinates>12.2326307364384,44.14503408034735,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Hippotram</name>
<styleUrl>#msn_ylw-pushpin0</styleUrl>
<LineString>
<tessellate>1</tessellate>
<coordinates>
12.23019968047102,44.1436990646726,0 12.22982723982488,44.14371451997106,0 12.22963125156578,44.14390015883947,0 12.2293344934247,44.14428380914369,0 12.2291687267439,44.14455846684811,0 12.22911579780884,44.144786432916,0 12.22912769073768,44.14493674615868,0 12.22920409962574,44.14514485027289,0 12.22934181817229,44.14527804320389,0 12.2295494402961,44.14545510763151,0 12.22971557136716,44.14554231761719,0 12.22993692210792,44.14560537872954,0 12.23024585350736,44.145690011482,0 12.23051108527029,44.14579843617741,0 12.23074374858207,44.1458609604246,0 12.23096670638319,44.14592153603664,0 12.23108580206972,44.14592153706389,0 12.23125903516813,44.14585905216096,0 12.23145383660227,44.14583574519224,0 12.23169198032639,44.14579701139562,0 12.23174672555664,44.14560357076742,0 12.23193607332347,44.14553335312404,0 12.23256728989408,44.14539276740531,0 12.23278065674339,44.1453117518474,0 12.23311024627987,44.14521065612707,0 12.23332162685084,44.14510967496832,0 12.23353705651073,44.14495022375198,0 12.23368397699932,44.14475166886797,0 12.2337229642892,44.14458509890444,0 12.23390458901544,44.14386971743652,0 12.23389798785112,44.1437424580886,0 12.23384941766567,44.1436688803758,0 12.23373608814992,44.14359917667694,0 12.23305072205924,44.14338619880129,0 12.23247379909847,44.14320921182975,0 12.23202528486844,44.14310634472822,0 12.23190676351169,44.14310651184951,0 12.2318745601584,44.14314486232821,0 12.2317560785995,44.14314102446708,0 12.23150296630336,44.14316789058185,0 12.23063015710304,44.14333390592292,0 12.23052750967561,44.14340332211442,0 12.23051638225097,44.14348821686089,0 12.23052684981566,44.14356544303134,0 12.23048884155054,44.14362725695248,0 12.23039691605805,44.14367750144516,0 12.23028895992643,44.14368909780256,0
</coordinates>
</LineString>
</Placemark>
</Folder>
</Document>
</kml>
Codice: Seleziona tutto
/* NDSFutility.js JavaScript functions for NDSF coordinate conversion utility */
PI = 3.1415927;
RADIANS = 57.2957795; /* degrees/radian */
RADIUS = 6378137.0;
FLATTENING = 0.00335281068; /* GRS80 or WGS84 */
K_NOT = 0.9996; /* UTM scale factor */
DEGREES_TO_RADIANS = 0.01745329252;
FALSE_EASTING = 500000.0;
FALSE_NORTHING = 10000000.0;
/*----------------------------------------------------------
# The following functions are modified from the origin
# C functions created by Louis Whitcomb 19 Jun 2001
---------------------------------------------------------*/
function utm_zone(slat, slon)
{
with(Math)
{
/* determine the zone for the given longitude
with 6 deg wide longitudinal strips */
var zlon= slon + 180; /* set the lon from 0-360 */
for (var i=1; i<=60; i++)
{
if ( zlon >= (i-1)*6 & zlon < i*6)
{
break;
}
}
var zone=i;
/* modify the zone number for special areas */
if ( slat >=72 & (slon >=0 & slon <=36))
{
if (slon < 9.0)
{
zone= 31;
}
else if ( slon >= 9.0 & slon < 21)
{
zone= 33;
}
else if ( slon >= 21.0 & slon < 33)
{
zone= 35;
}
else if ( slon >= 33.0 & slon < 42)
{
zone= 37;
}
}
if ( (slat >=56 & slat < 64) & (slon >=3 & slon < 12))
{
zone= 32; /* extent to west ward for 3deg more */
}
return (zone);
}
return true;
}
/*-------------------------------------------------*/
function geo_utm(lat, lon, zone)
{
with(Math)
{
/* first compute the necessary geodetic parameters and constants */
lambda_not = ((-180.0 + zone*6.0) -3.0)/RADIANS ;
e_squared = 2.0 * FLATTENING - FLATTENING*FLATTENING;
e_fourth = e_squared * e_squared;
e_sixth = e_fourth * e_squared;
e_prime_sq = e_squared/(1.0 - e_squared);
sin_phi = sin(lat);
tan_phi = tan(lat);
cos_phi = cos(lat);
N = RADIUS/sqrt(1.0 - e_squared*sin_phi*sin_phi);
T = tan_phi*tan_phi;
C = e_prime_sq*cos_phi*cos_phi;
M = RADIUS*((1.0 - e_squared*0.25 -0.046875*e_fourth -0.01953125*e_sixth)*lat-
(0.375*e_squared + 0.09375*e_fourth +
0.043945313*e_sixth)*sin(2.0*lat) +
(0.05859375*e_fourth + 0.043945313*e_sixth)*sin(4.0*lat) -
(0.011393229 * e_sixth)*sin(6.0*lat));
A = (lon - lambda_not)*cos_phi;
A_sq = A*A;
A_fourth = A_sq*A_sq;
/* now go ahead and compute X and Y */
x_utm = K_NOT*N*(A + (1.0 - T + C)*A_sq*A/6.0 +
(5.0 - 18.0*T + T*T + 72.0*C -
58.0*e_prime_sq)*A_fourth*A/120.0);
/* note: specific to UTM, vice general trasverse mercator.
since the origin is at the equator, M0, the M at phi_0,
always equals zero, and I won't compute it */
y_utm = K_NOT*(M + N*tan_phi*(A_sq/2.0 +
(5.0 - T + 9.0*C + 4.0*C*C)*A_fourth/24.0 +
(61.0 - 58.0*T + T*T + 600.0*C -
330.0*e_prime_sq)*A_fourth*A_sq/720.0));
/* now correct for false easting and northing */
if( lat < 0)
{
y_utm +=10000000.0;
}
x_utm +=500000;
/* adds Java function returns */
var utmxy={};
utmxy={x:x_utm,y:y_utm};
return(utmxy);
}
return true;
}
Codice: Seleziona tutto
<!--
Google Earth .kml to Rail3D labels converter
(c) copyright 2011 Roberto Ceccarelli
-->
<job>
<runtime>
<named name="kml" helpstring="File kml da convertire" required="true" type="string" />
<named name="lat0" helpstring="Latitudine punto base" required="true" type="string" />
<named name="lon0" helpstring="Longitudine punto base" required="true" type="string" />
<named name="utmzone" helpstring="Fuso UTM in cui effettuare la conversione (se omesso viene calcolato sulla longitudine del punto base)" required="false" type="string" />
<named name="xoffset" helpstring="Offset orizzontale in metri del punto base" required="false" type="string" />
<named name="yoffset" helpstring="Offset verticale in metri del punto base" required="false" type="string" />
</runtime>
<script language="JScript" src="NDSFlib.js">
</script>
<script language="JScript">
// check main arguments
if( !WScript.Arguments.Named.Exists("kml")
|| !WScript.Arguments.Named.Exists("lat0")
|| !WScript.Arguments.Named.Exists("lon0") ) {
WScript.Arguments.ShowUsage();
WScript.Quit();
}
var ll = {
olat: WScript.Arguments.Named("lat0")*1,
olon: WScript.Arguments.Named("lon0")*1,
xoffset: 0,
yoffset: 0
}
// detect utm zone
if( WScript.Arguments.Named.Exists("utmzone") ) {
ll.utmzone = WScript.Arguments.Named("utmzone")*1;
} else {
ll.utmzone = utm_zone(ll.olat, ll.olon);
}
// optional offsets
if( WScript.Arguments.Named.Exists("xoffset") ) {
ll.xoffset = WScript.Arguments.Named("xoffset")*1;
}
if( WScript.Arguments.Named.Exists("yoffset") ) {
ll.yoffset = WScript.Arguments.Named("yoffset")*1;
}
// convert origin point to utm
var xy = geo_utm(ll.olat/RADIANS, ll.olon/RADIANS, ll.utmzone);
ll.x0 = xy.x;
ll.y0 = xy.y;
// parsing kml file
var kml = new ActiveXObject("msxml2.domdocument");
kml.async = false;
kml.load(WScript.Arguments.Named("kml") + ".kml");
var marklist = kml.getElementsByTagName("Placemark");
var marker, coord;
var re = /^(d+.d+),(d+.d+).*/;
for(var i=0; i<marklist.length; i++) {
marker = marklist.item(i);
coord = marker.getElementsByTagName("coordinates").item(0).text;
ll.slon = coord.replace(re, "$1")*1;
ll.slat = coord.replace(re, "$2")*1;
xy = geo_utm(ll.slat/RADIANS, ll.slon/RADIANS, ll.utmzone);
WScript.StdOut.WriteLine(""TEXT"t"+ Math.floor(xy.x - ll.x0 + ll.xoffset) +"t"+ Math.floor(xy.y - ll.y0 + ll.yoffset) +"t"" + marker.getElementsByTagName("name").item(0).text +""" );
}
</script>
</job>
Codice: Seleziona tutto
cscript kml2label.wsf //Nologo ^
/kml:ippodromo ^
/lat0:44.14382792157764 /lon0:12.23207537755476 ^
/xoffset:20000 /yoffset:20000 ^
>ippodromo_lbl.csv
Codice: Seleziona tutto
"TEXT" 20000 20000 "Arrivo"
"TEXT" 19993 19976 "Arrivo lato tribuna"
"TEXT" 20048 20132 "per calcolo inclinazione"
"TEXT" 19849 19990 "Hippotram"
da timetable57 » 6 ott 2011, 1:32
da strawberryfield » 6 ott 2011, 9:51
timetable57 ha scritto:
Grande Roberto, aspettavo questo tool. Mi riservo di leggere con calma il tutto. Potresti però per piacere tradurlo in un programmino come quell'altro? Così provo e poi pubblico. Sottoponilo anche a Mark. Grazie |
da strawberryfield » 8 ott 2011, 14:07
da timetable57 » 8 ott 2011, 14:58
da strawberryfield » 10 ott 2011, 22:53
da timetable57 » 10 ott 2011, 23:46
da strawberryfield » 11 ott 2011, 10:20
timetable57 ha scritto:
Per il tuo programma bisognerebbe vedere se si potessero implementare in qualche modo le DEM. |
da timetable57 » 11 ott 2011, 11:26
da strawberryfield » 20 ott 2011, 11:22
da timetable57 » 21 ott 2011, 1:00
da strawberryfield » 21 ott 2011, 9:42
timetable57 ha scritto:
Io però l'ho provato e qualcosa non ho capito. Cosa intendi per copiare il contenuto del file .csv nella cartella principale di rail3D? |
da strawberryfield » 22 ott 2011, 13:28
da timetable57 » 22 ott 2011, 15:35