Dienstag, 14. Juli 2015

Map workflow - separate files for specific area

Situation: ca 7000 tiled raster files in one folder but only a subset for a specific area is required, SHP file containing tiles and filenames and SHP file with area of interest available

raster tiles (green), area of interest (blue)


1 - load both SHP files into Map
2 - spatial query to select tiles for area of interest

raster tiles for area of interest

3 - export attribute data for selection

shp with tiles (selection for area of interest) - export attribute data (filenames) 

4 - open attribute data in Excel
5 - extract exact filename with Excel and add addtional parameters (DOS commands), as result you need something like this: 

copy 6895_2595_r3x.tif c:\temp\dom
copy 6895_2600_r3x.tif c:\temp\dom
copy 6895_2605_r3x.tif c:\temp\dom

further processing in Excel

6 - copy result into new textfile, save as BAT file into folder with raster files and execute

What happens if you do not have a SHP file containg tiles and filenames?

This might be an option to create one with Map:

- load raster files into Map (command: _mapiinsert), choose option to show frame only (do not load thousands of raster files, only let Map display the frames)

_mapiinsert - show frames only

- add AutoCAD layer with image frames to DisplayManager (query current drawing)

- add a label to the newly add layer, choose ".IMAGENAME" as label text

label added to iamge frames - path to file is used as text

- export as SHP (command: _mapexport), export option "Text" : you will get a Point SHP with text insertion points as points and label text as attribute

- use point shape for spatial query

Freitag, 10. Juli 2015

MapGuide / AIMS - show number of sessions

As shown in Jackie's blog one can easily count the number of current sessions. I put such a counter on our internal web site where we keep links to different web interfaces and scripts related to our AIMS/MapGuide installations:

The script is written in PHP:

 // for remote server  
 // (1) INLCUDE ../vaw_settings.php;  
 // for local server  
 // (1) INLCUDE Verweis mit ./vaw_settings.php;  
 include './vaw_settings.php';  
 $fi = new FilesystemIterator($pathSessionRepository, FilesystemIterator::SKIP_DOTS);  
 $number = (iterator_count($fi)-1)/2 ;   
 // for remote server  
 // (2) echo $number;  
 // for local server  
 // (2) return $number;  
 return $number;  

The vaw_settings.php file contains only the path to MapGuide session repository ($pathSessionRepository).

The script for counting current sessions is called from within another PHP script which runs on one of the AIMS servers. It also calls the slightly modified version of the script on the remote server:

 $script_number_users = 'misc/count_logged_users.php';  
 //local server  
 //only relative path to script  
 $request_url = $script_number_users;  
 echo "# of users logged in ($label_server1):____".include($request_url).".";  
 //remote server  
 //complete url  
 $request_url = $basis_url_server3.$url_vaw_scripte.$script_number_users;  
 echo "# of users logged in ($label_server3):____".file_get_contents($request_url).".";  

Depending on whether the script runs locally or remotely it needs to be modified slightly (see comments in scripts) and the way the script is called varies as well (relative path vs. complete URL, include vs. file_get_contents). 

AIMS/MapGuide 2013

Donnerstag, 9. Juli 2015

create view with unique FID

We have an Oracle view where no unique FID can be retrieved. Without an unique FID Map will not display the data in a form (industry model).

In our situation we only need a unique ID for the sake of the FID requirement by Map. To generate such a unique ID we chose the following approach:

- the view is wrapped by a select statement which includes rownum:

 create or replace view my_view as select  
 rownum fid, t.* from  
  ... view definition ...  
  ) t;  

As we need to show the data of the view only occasionally performance is not a major concern here.

Map 2013, SP2