comment
IRC Chat
play_arrow
Este sitio utiliza cookies propias y de terceros. Si continúa navegando consideramos que acepta el uso de cookies. OK Más Información.

Script para convertir planos cartograficos de OPENJUMP a AMCHARTS SVG JSON

  • 0 Respuestas
  • 1385 Vistas

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado graphixx

  • *
  • Moderador
  • Mensajes: 1258
  • Actividad:
    43.33%
  • Reputación 17
  • Científico de BIG DATA
    • Ver Perfil
    • Sistemas y Controles
« en: Septiembre 21, 2015, 11:18:27 pm »
Script original que genera los mapas acá:
No tienes permisos para ver links. Registrate o Entra con tu cuenta

Historia: En cuestión necesitaba generar un mapa interactivo de Colombia y AMCHARTS se trago las islas de la región marítima, y los mapas SVG de la red no son compatibles con el protocolo de amcharts, me toco generar el mapa con el software gratuito OpenJUMP (No tienes permisos para ver links. Registrate o Entra con tu cuenta) el cual genera en efecto el mapa con islas en formato "similar" al usado por amcharts así:
No tienes permisos para ver links. Registrate o Entra con tu cuenta

EL formato de amcharts es algo con comas y las L juntas en fin si observan los mapas nombredelpaisLow.js se daran cuenta, y OpenJUMP entrega ese mapa SVG sin comas ni las L juntas, asi que me toco hacer este script:

Código: PHP
  1. <?php
  2.  
  3. $cadena = "M364.9709 181.2713 L364.9709 181.3306 L365.0583 181.3306 L365.0583 181.3894 L365.2308 181.3894 L365.2308 181.6272 L365.1433 181.6272 L365.1433 181.6867 L365.3158 181.6867 L365.3158 181.7463 L365.4009 181.7463 L365.4009 181.8645 L365.4883 181.8645 L365.4883 181.924 L365.5733 181.9244 L365.5733 182.0428 L365.6608 182.0428 L365.6608 182.1617 L365.7458 182.1617 L365.7458 182.2805 L365.8309 182.2805 L365.8309 182.3993 L365.7458 182.3993 L365.7458 182.6366 L365.8309 182.6366 L365.8309 182.7554 L365.9183 182.7554 L365.9183 182.8147 L367.7233 182.8147 L367.7233 182.8739 L367.8108 182.8739 L367.8108 182.9332 L367.8958 182.9332 L367.8958 183.052 L367.9832 183.052 L367.9832 183.1115 L368.0683 183.1115 L368.0683 183.1709 L368.1533 183.1709 L368.1533 183.2304 L368.2408 183.2304 L368.2408 183.2897 L368.4132 183.2897 L368.4132 183.3488 L368.4983 183.3488 L368.4983 183.4081 L368.4132 183.4081 L368.4132 183.5269 L368.3258 183.5269 L368.3258 183.5865 L368.2408 183.5865 L368.2408 183.6458 L368.1533 183.6458 L368.1533 183.7055 L368.0683 183.7055 L368.0683 183.7648 L367.9832 183.7648 L367.9832 183.8237 L367.8958 183.8237 L367.8958 183.883 L367.8108 183.883 L367.8108 183.9426 L367.7233 183.9426 L367.7233 184.0616 L367.6383 184.0616 L367.6383 184.1209 L367.5532 184.1209 L367.5532 184.1804 L367.4658 184.1804 L367.4658 184.2397 L367.3807 184.2397 L367.3807 184.2986 L367.2933 184.2986 L367.2933 184.3586 L367.2083 184.3586 L367.2083 184.4177 L367.1232 184.4177 L367.1232 184.477 L367.2083 184.477 L367.2083 184.5365 L367.2933 184.5365 L367.2933 184.5958 L367.3807 184.5958 L367.3807 184.7147 L367.4658 184.7147 L367.4658 184.7738 L367.5532 184.7742 L367.5532 184.8335 L367.6383 184.8335 L367.6383 184.8926 L367.4658 184.8926 L367.4658 184.9519 L367.2083 184.9519 L367.2083 185.0114 L367.2933 185.0114 L367.2933 185.1303 L367.3807 185.1303 L367.3807 185.308 L367.4658 185.308 L367.4658 185.4269 L367.5532 185.4269 L367.5532 185.5457 L367.6383 185.5457 L367.6383 185.6052 L367.7233 185.6052 L367.7233 185.724 L367.8108 185.724 L367.8108 185.8423 L367.8958 185.8423 L367.8958 185.9018 L367.9832 185.9018 L367.9832 186.0206 L368.0683 186.0206 L368.0683 186.1395 L368.1533 186.1395 L368.1533 186.3767 L368.2408 186.3767 L368.2408 186.6146 L368.3258 186.6146 L368.3258 186.6739 L368.5857 186.6739 L368.5857 186.6146 L368.8432 186.6146 L368.8432 186.5549 L369.1007 186.5549 L369.1007 186.4956 L369.2732 186.4956 L369.2732 186.436 L369.6158 186.436 L369.6158 186.4956 L369.7032 186.4956 L369.7032 186.6146 L369.7883 186.6146 L369.7883 187.2084 L369.7032 187.2084 L369.7032 187.4456 L369.6158 187.4456 L369.6158 187.6833 L369.5307 187.6833 L369.5307 187.7422 L368.8432 187.7422 L368.8432 187.8017 L368.6707 187.8017 L368.6707 187.861 L368.4983 187.861 L368.4983 187.9205 L368.3258 187.9205 L368.3258 187.9799 L368.1533 187.9799 L368.1533 188.0394 L368.0683 188.0394 L368.0683 188.0987 L367.8958 188.0987 L367.8958 188.1582 L367.8108 188.1582 L367.8108 188.2171 L367.7233 188.2171 L367.7233 188.336 L367.6383 188.336 L367.6383 188.3955 L367.5532 188.3955 L367.5532 188.4548 L367.6383 188.4548 L367.6383 188.5736 L367.7233 188.5736 L367.7233 188.692 L367.8108 188.692 L367.8108 188.8109 L367.8958 188.8109 L367.8958 188.8704 L367.7233 188.8704 L367.7233 189.1081 L367.6383 189.1081 L367.6383 189.6425 L367.7233 189.6425 L367.7233 189.7607 L367.8108 189.7607 L367.8108 189.8203 L367.8958 189.8203 L367.8958 189.8798 L367.9832 189.8798 L367.9832 189.9986 L368.0683 189.9986 L368.0683 190.1174 L367.9832 190.1174 L367.9832 190.3547 L367.8958 190.3547 L367.8958 190.5331 L367.8108 190.5331 L367.8108 190.7112 L367.7233 190.7112 L367.7233 190.889 L367.6383 190.889 L367.6383 191.0078 L367.5532 191.0078 L367.5532 191.1266 L367.4658 191.1266 L367.4658 191.2451 L367.3807 191.2451 L367.3807 191.3639 L367.2933 191.3639 L367.2933 191.4827 L367.2083 191.4827 L367.2083 191.6015 L367.1232 191.6015 L367.1232 191.72 L367.0358 191.72 L367.0358 191.8388 L366.9507 191.8388 L366.9507 191.9576 L366.8633 191.9576 L366.8633 192.0765 L366.7783 192.0765 L366.7783 192.1949 L366.6932 192.1949 L366.6932 192.2544 L366.7783 192.2544 L366.7783 192.3733 L366.8633 192.3733 L366.8633 192.4326 L366.6932 192.4326 L366.6932 192.4923 L366.5208 192.4923 L366.5208 192.5516 L366.0034 192.5516 L366.0034 192.6105 L365.5733 192.6105 L365.5733 192.6705 L365.0583 192.6705 L365.0583 192.7294 L364.5409 192.7294 L364.5409 192.7889 L364.3684 192.7889 L364.3684 192.8484 L364.1983 192.8484 L364.1983 192.9077 L363.9384 192.9077 L363.9384 192.9672 L363.7683 192.9672 L363.7683 193.0266 L363.5958 193.0266 L363.5958 193.1454 L363.5084 193.1454 L363.5084 193.2638 L363.4234 193.2638 L363.4234 193.3826 L363.3383 193.3826 L363.3383 193.4422 L363.1658 193.4422 L363.1658 193.5015 L363.0784 193.5015 L363.0784 193.561 L362.9933 193.561 L362.9933 193.6199 L362.9083 193.6199 L362.9083 193.6794 L362.8209 193.6794 L362.8209 193.7387 L362.7358 193.7387 L362.7358 193.7982 L362.6484 193.7982 L362.6484 193.8576 L362.5634 193.8576 L362.5634 193.9171 L362.476 193.9171 L362.476 193.9764 L362.3909 193.9764 L362.3909 194.0948 L362.3058 194.0948 L362.3058 194.2137 L362.2184 194.2137 L362.2184 194.3325 L362.046 194.3325 L362.046 194.392 L361.9609 194.392 L361.9609 194.4513 L361.7884 194.4513 L361.7884 194.5108 L361.616 194.5108 L361.616 194.5698 L361.4458 194.5698 L361.4458 194.6297 L361.3584 194.6297 L361.3584 194.6886 L361.1859 194.6886 L361.1859 194.7479 L361.0158 194.7479 L361.0158 194.8074 L360.4984 194.8074 L360.4984 194.7479 L360.4134 194.7479 L360.4134 194.6886 L359.9834 194.6886 L359.9834 194.7479 L359.7235 194.7479 L359.7235 194.8074 L359.5534 194.8074 L359.5534 194.8667 L359.2935 194.8667 L359.2935 194.9263 L359.036 194.9263 L359.036 194.9856 L358.8635 194.9856 L358.8635 195.0447 L358.606 195.0447 L358.606 195.1048 L358.691 195.1048 L358.691 195.2228 L358.7784 195.2228 L358.7784 195.2824 L358.691 195.2824 L358.691 195.3417 L358.5209 195.3417 L358.5209 195.4014 L358.4335 195.4014 L358.4335 195.4607 L357.831 195.4607 L357.831 195.4014 L357.5735 195.4014 L357.5735 195.3417 L357.2309 195.3417 L357.2309 195.2824 L356.971 195.2824 L356.971 195.2228 L356.886 195.2228 L356.886 194.8667 L356.7986 194.8667 L356.7986 194.7479 L356.7135 194.7479 L356.7135 194.6886 L356.6284 194.6886 L356.6284 194.6297 L356.541 194.6297 L356.541 194.5108 L356.456 194.5108 L356.456 194.4513 L356.3686 194.4513 L356.3686 194.3325 L356.2835 194.3325 L356.2835 194.2137 L356.1985 194.2137 L356.1985 193.9171 L356.2835 193.9171 L356.2835 193.7982 L356.3686 193.7982 L356.3686 193.6794 L356.2835 193.6794 L356.2835 193.561 L356.3686 193.561 L356.3686 193.4422 L356.456 193.4422 L356.456 193.3233 L356.541 193.3233 L356.541 193.2045 L356.6284 193.2045 L356.6284 193.0266 L356.541 193.0266 L356.541 192.7294 L356.456 192.7294 L356.456 192.5516 L356.3686 192.5516 L356.3686 192.4326 L356.2835 192.4326 L356.2835 192.3138 L356.1985 192.3138 L356.1985 192.1949 L356.1111 192.1949 L356.1111 191.8388 L355.9386 191.8388 L355.9386 191.7795 L355.7685 191.7795 L355.7685 191.72 L355.5086 191.72 L355.5086 191.6607 L355.3385 191.6607 L355.3385 191.6015 L355.166 191.6015 L355.166 191.5422 L354.9935 191.5422 L354.9935 191.1861 L355.166 191.1861 L355.166 191.1266 L355.251 191.1262 L355.251 191.0078 L355.3385 191.0078 L355.3385 190.7112 L355.4235 190.7112 L355.4235 190.4142 L355.5086 190.4142 L355.5086 190.3547 L355.681 190.3547 L355.681 190.2952 L355.7685 190.2952 L355.7685 190.2359 L355.8535 190.2359 L355.8535 189.6425 L355.9386 189.6425 L355.9386 189.4642 L356.026 189.4642 L356.026 189.0486 L355.9386 189.0486 L355.9386 188.692 L355.8535 188.692 L355.8535 188.5736 L355.7685 188.5736 L355.7685 188.5143 L355.681 188.5143 L355.681 188.336 L355.7685 188.336 L355.7685 188.2171 L355.8535 188.2171 L355.8535 188.0987 L355.9386 188.0987 L355.9386 187.861 L356.026 187.861 L356.026 187.5645 L356.1111 187.5645 L356.1111 187.3268 L356.1985 187.3268 L356.1985 187.1488 L356.2835 187.1488 L356.2835 187.03 L356.3686 187.03 L356.3686 186.911 L356.456 186.911 L356.456 186.7927 L356.541 186.7927 L356.541 186.7328 L356.6284 186.7328 L356.6284 186.6146 L356.7135 186.6146 L356.7135 186.4956 L356.7986 186.4956 L356.7986 186.436 L356.886 186.436 L356.886 186.318 L356.971 186.318 L356.971 186.1988 L357.0584 186.1988 L357.0584 186.0799 L357.1435 186.0799 L357.1435 186.0206 L357.2309 186.0206 L357.2309 185.9018 L357.316 185.9018 L357.316 185.783 L357.401 185.783 L357.401 185.6645 L357.4885 185.6645 L357.4885 185.4864 L357.5735 185.4864 L357.5735 185.3676 L357.831 185.3676 L357.831 185.308 L357.9185 185.308 L357.9185 185.2491 L358.0035 185.2491 L358.0035 185.1303 L358.0909 185.1303 L358.0909 185.0708 L358.176 185.0708 L358.176 185.0114 L358.261 185.0114 L358.261 184.8926 L358.3484 184.8926 L358.3484 184.7742 L358.4335 184.7738 L358.4335 184.6553 L358.5209 184.6553 L358.5209 184.5365 L359.036 184.5365 L359.036 184.477 L359.1234 184.477 L359.1234 184.4177 L359.2935 184.4177 L359.2935 184.3586 L359.3809 184.3586 L359.3809 184.2986 L359.466 184.2986 L359.466 184.1804 L359.7235 184.1804 L359.7235 184.2986 L359.8109 184.2986 L359.8109 184.4177 L360.0684 184.4177 L360.0684 184.3586 L360.5835 184.3586 L360.5835 184.5958 L360.6709 184.5958 L360.6709 184.7147 L361.0158 184.7147 L361.0158 184.7738 L361.2734 184.7742 L361.2734 184.8335 L361.616 184.8335 L361.616 184.7742 L361.8759 184.7738 L361.8759 184.7147 L362.1334 184.7147 L362.1334 184.6553 L362.3909 184.6553 L362.3909 184.5958 L362.6484 184.5958 L362.6484 184.477 L362.7358 184.477 L362.7358 184.2986 L362.8209 184.2986 L362.8209 184.2397 L362.9083 184.2397 L362.9083 184.1209 L362.9933 184.1209 L362.9933 184.0616 L363.0784 184.0616 L363.0784 183.9426 L363.1658 183.9426 L363.1658 182.9332 L363.0784 182.9332 L363.0784 182.5178 L362.9933 182.5178 L362.9933 182.4583 L362.9083 182.4583 L362.9083 182.3993 L362.9933 182.3993 L362.9933 182.3394 L363.0784 182.3394 L363.0784 182.2805 L363.1658 182.2805 L363.1658 182.221 L363.2509 182.221 L363.2509 182.1617 L363.3383 182.1617 L363.3383 182.1022 L363.4234 182.1022 L363.4234 182.0428 L363.5084 182.0428 L363.5084 181.9833 L363.5958 181.9833 L363.5958 181.9244 L364.1109 181.924 L364.1109 181.3894 L364.1983 181.3894 L364.1983 181.3306 L364.8008 181.3306 L364.8008 181.2713z";
  4. echo $cadena;
  5. //$pos = strpos($cadena, " ");
  6.  
  7. $texto = No tienes permisos para ver links. Registrate o Entra con tu cuenta(" ", $cadena);
  8. $longitud = No tienes permisos para ver links. Registrate o Entra con tu cuenta($texto);
  9.  
  10. for($i=0; $i<$longitud; $i++)
  11.       {
  12.            
  13.          if(No tienes permisos para ver links. Registrate o Entra con tu cuenta($texto[$i])){
  14.      //la variable es un numero
  15.          $pos = $pos . "," . $texto[$i];
  16.      }else{
  17.      //la variable no es numero
  18.          $pos = $pos . $texto[$i];
  19.      }
  20.                    
  21. }
  22.  
  23. echo $pos;
  24. ?>
  25.  

Espero a alguien mas le sirva, si esta liado tratando de colocarle islas a su mapa, los tutoriales de amcharts dejan mucho que desear y yo me tarde "HORAS Y HORAS" buscando una solución.

PD:  Apenas termine el mapa interactivo de Colombia lo comparto por aca, pendientes.
No tienes permisos para ver links. Registrate o Entra con tu cuenta

 

¿Te gustó el post? COMPARTILO!



10 Mejores Librerías Para Seguridad En PHP - Seguridad De Datos Desde PHP

Iniciado por graphixx

Respuestas: 0
Vistas: 1833
Último mensaje Enero 23, 2016, 06:03:10 am
por graphixx
[APORTE] edPDF - "Libreria" para edicion y creacion de PDFs

Iniciado por kid_goth

Respuestas: 4
Vistas: 990
Último mensaje Marzo 10, 2014, 07:15:31 pm
por kid_goth
UserClass [Clase abstracta para manejar usuarios en cualquier sistema y ocasión]

Iniciado por alexander1712

Respuestas: 0
Vistas: 970
Último mensaje Octubre 08, 2013, 04:37:07 pm
por alexander1712
Clase para crear y modificar un archivo Excel desde PHP

Iniciado por ANTRAX

Respuestas: 0
Vistas: 1802
Último mensaje Febrero 24, 2010, 11:42:44 am
por ANTRAX
[Tutorial] Utilizar el método GET para simplificar páginas [Xt3mP]

Iniciado por Xt3mP

Respuestas: 0
Vistas: 1215
Último mensaje Marzo 19, 2010, 01:15:53 am
por Xt3mP