<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />이전 게시물에서는 낮은 배경 비트맵으로 표현되고 밤은 속이 빈 윤곽선으로 표현되는 세계의 주야간 지도를 만들었습니다.이 예에서는 IP 위치를 표시하여 야간 지도에 흥미로운 세부 정보를 추가하고 아래 지도의 야간 섹션에 노란색 안개를 생성하는 방법을 보여줍니다.
더 큰 이미지를 보려면 클릭하세요...

IP 위치는 스크립트가 MaxMind에서 다운로드하는 파일에서 나옵니다.그들의 데이터는 매우 훌륭하며 IP 주소를 위치에 매핑할 수 있습니다.여기서는 그런 용도로 사용하지 않습니다.통지 내용은 다음과 같습니다.
This example includes GeoLite data created by MaxMind, available from http://www.maxmind.com.
파일이 꽤 크기 때문에 이 JSL은 데이터가 $temp 디렉토리에 이미 다운로드되었는지 확인합니다.TRY 문이 테이블을 열지 못하는 경우(쉼표 앞의 첫 번째 문) 잡다 의 일부 노력하다 (쉼표 뒤의 명령문) 새로운 사본을 다운로드하여 저장합니다.다운로드는 두 개의 open() 문을 사용합니다. 첫 번째는 zip 아카이브를 가져오고, 두 번째는 zip 아카이브에서 읽은 CSV 구성원에 대한 텍스트 가져오기를 수행합니다.테이블을 저장하기 직전에(Lat, Lon 열만 포함) <
// download the maxmind zip file http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/GeoLiteCity-latest.zip// it isn't required, but provides a beautiful nighttime glow around parts of the world with internet connections.Try( cityloc = Open( "$temp/cityloc.jmp" ); // try to open an existing saved table , // if that fails, open a zip archive from the internet za = Open( "http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/GeoLiteCity-latest.zip", "zip" ); zipMemberList = za << dir;// there are two files in the zipped archive, with any luck, this is still the name... // this zip archive member has the Lat,Lon data citylocblob = za << read( zipMemberList[If( // the member name includes a date that changes. this should pick the right member Ends With( zipMemberList[1], "GeoLiteCity-Location.csv" ), 1, Ends With( zipMemberList[2], "GeoLiteCity-Location.csv" ), 2, . // if this happens, perhaps there is an extra file in the zip? )], Format( blob ) ); cityloc = Open( citylocblob, // open understands a blob can hold CSV data columns( // there are only two cols we need Omitted Column( . ), Omitted Column( . ), Omitted Column( . ), Omitted Column( . ), Omitted Column( . ), Column( "latitude", Numeric, "Continuous", Format( "Best", 10 ) ), Column( "longitude", Numeric, "Continuous", Format( "Best", 10 ) ), Omitted Column( . ), Omitted Column( . ) ), Import Settings( // runs fast when it doesn't have to guess End Of Line( CRLF, CR, LF ), End Of Field( Comma, CSV( 1 ) ), Strip Quotes( 1 ), Use Apostrophe as Quotation Mark( 0 ), Scan Whole File( 1 ), Treat empty columns as numeric( 0 ), CompressNumericColumns( 0 ), CompressCharacterColumns( 0 ), CompressAllowListCheck( 0 ), Labels( 1 ), Column Names Start( 2 ), Data Starts( 3 ), Lines To Read( "All" ), Year Rule( "20xx" ) ) ); // add Creative Commons Attribution-ShareAlike 3.0 Unported License text MaxMind wants... cityloc << settablevariable( "MaxMind", "This table includes GeoLite data created by MaxMind, available from http://www.maxmind.com" ); cityloc<);
상단 지도의 야간 영역 경계 내부에 노란색-흰색 영역을 생성하는 약 3/4백만 개의 위치를 얻게 됩니다(그리고 테이블을 자주 업데이트하기 때문에 다른 수의 행을 얻게 됩니다).

스크립트의 다음 부분에서는 Time Zone 함수를 사용합니다. 몇 개의 게시물이 다시 돌아왔습니다. .지도의 태양/그림자를 올바른 위치에 배치하려면 GMT 시간이 필요합니다. 지금 .스크립트의 나머지 부분은 다음과 매우 유사합니다. 이전 스크립트 , 추가 위치를 그리기 위해 GraphBox에 단 하나의 추가 스크립트가 추가되었습니다(및 위도, 경도 행렬에 위치를 로드하는 작은 스크립트).
Try( IPdt = cityloc; lat = IPdt:latitude << getasmatrix; lon = IPdt:longitude << getasmatrix;, // data not available? lat = []; lon = [];);g[framebox( 1 )] << addGraphicsScript( 3, // before shape's new position, after the shadow transparency(.2); Marker( Color State( {0.8, 0.8, 0.7} ),lon, lat ););참고 사항: 컴퓨터 시계가 몇 초 이상 변동된 경우 시간대 기능은 정수를 반환하지 않습니다.내 집 컴퓨터가 약 4초 정도 꺼졌고 5가 아닌 4.999가 보고되었습니다(스크립트의 반올림 기능이 소수점 세 자리를 요구하기 때문입니다).이와 같이 반올림하면 숫자 사용 방법에 따라 결과에 영향을 미칠 수 있습니다.
try()는 Lat, Lon이 행렬인지 확인하며, 문제가 발생하면 비어 있을 수도 있습니다.그래픽 스크립트는 Lat, Lon 매트릭스에서 마커를 생성하고 RGB 색상을 밝은 노란색 그래프로 설정합니다..2의 투명도는 중복된 점이 단일 점보다 더 강렬하게 표시되도록 합니다.노란색은 그래프의 낮 부분에서 포인트를 덜 명확하게 만들고 지도 텍스처 중 일부가 그 아래에서 손실됩니다.
예정: 트위터 데이터 캡처:
