I recently figured out that a web service class I was dealing with (WFS in OpenLayers) would only accept requests through a proxy script (despite the requests were sent to my local machine!). OpenLayers has a .cgi proxy script which runs through Python, and here's how I got it to work:
1. Download proxy.cgi to the cgi-bin folder within xampp (or wherever it is), and install Python. I used version 2.5
2. Follow these instructions to setup Apache for running python
3. Finally, make sure you change the "shebang" line at the top of proxy.cgi from #!/usr/bin/env python to #!c:/python25/python (if python.exe is installed at C:\Python25\python.exe)
Wednesday, April 21, 2010
Monday, March 15, 2010
Tilecaching MXD/ArcGIS Server to file/folder-based only (e.g. google, mapnik)
So it seems like there's no automated way to go from mxd to file/folder based (rather than web service) tile cache. The best I could do was use maptiler/gdal2tiles (maptiler is a very nice gui for gdal2tiles) to cache raster layers. This will fuse multiple raster layers, but doesn't handle vectors. If you want to pass vectors through here you can always convert to raster with some other tool but you'll end up loosing any scale dependencies. Please note, you'll likely have to incorporate a part of their auto-generated code for google maps, since the file naming doesn't completely conform to x/y/z google scheme naming. I've included my modified tile provider class for the gmap_overlays submodule (part of the gmap addons submod collection ... lives in PATH_TO_DRUPAL\sites\all\modules\gmap_addons\gmap_overlays\js), which handles output from maptiler/gdal2tiles.
note: exposing as wms and using tilecache might be a good idea, but this non-automated solution that is OK for me right now
note: exposing as wms and using tilecache might be a good idea, but this non-automated solution that is OK for me right now
Thursday, March 11, 2010
AGS error: #000569: Failed to generate cache. All server contexts failed to cache map.
I was getting the following error when trying to cache a map service in ArcGIS Server/ArcCatalog: 000569: Failed to generate cache. All server contexts failed to cache map.
I ultimately resolved this issue by upgrading my server software (ArcGIS Desktop) to the same version as my client (in my case 9.3.1 service pack 1). Caching only within a feature, which in my case was a three county polygon that was much larger than the area I wanted to cache, greatly improved performance ... I'm not sure if it even would have worked without that.
Note: if postinstallation hangs while upgrading server software check out this post: http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=32766
I ultimately resolved this issue by upgrading my server software (ArcGIS Desktop) to the same version as my client (in my case 9.3.1 service pack 1). Caching only within a feature, which in my case was a three county polygon that was much larger than the area I wanted to cache, greatly improved performance ... I'm not sure if it even would have worked without that.
Note: if postinstallation hangs while upgrading server software check out this post: http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=32766
Thursday, March 4, 2010
Drupal SWFTools Error
Was getting the following error: "You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly." on Chrome and I.E. only. Figured out that by changing the embed method under Embedding settings (Home>Administer>Site configuration>SWF Tools>Embedding settings) back to "Direct embedding - do not use JavaScript replacement" from " SWFObject 2 - JavaScript" I no longer get this error
Tile basemap through Views/GMaps module (Drupal)
To add a tiled basemap to a gmap created with views (and the gmaps) module:
1. First make sure that you have a gmap set up through views. This is a good tutorial: http://groups.drupal.org/node/19614
2. Next download the GMap Addons module, if you haven't already done so
3. Create a map tile structure using something like tilecache, mapcruncher, or ArcGIS (you can generate a map with the google maps scheme, just not sure where to get an xml that would adequately describe the scheme to ArcGIS)
4. Finally add a tile overlay macro within the style (GMap) configuration for this view. Use the following form:
[gmap |overlay=tile:http://host/tilesdirectory/{Z}/{X}/{Y}.png]
... notice you don't need to substitute anything for Z, X, or Y ... these correspond to folder numbering as generated with tilecache (or other tiling program) using the google maps scheme.
If you save the view you should now be able to see your basemap in a page generated by that view.
1. First make sure that you have a gmap set up through views. This is a good tutorial: http://groups.drupal.org/node/19614
2. Next download the GMap Addons module, if you haven't already done so
3. Create a map tile structure using something like tilecache, mapcruncher, or ArcGIS (you can generate a map with the google maps scheme, just not sure where to get an xml that would adequately describe the scheme to ArcGIS)
4. Finally add a tile overlay macro within the style (GMap) configuration for this view. Use the following form:
[gmap |overlay=tile:http://host/tilesdirectory/{Z}/{X}/{Y}.png]
... notice you don't need to substitute anything for Z, X, or Y ... these correspond to folder numbering as generated with tilecache (or other tiling program) using the google maps scheme.
If you save the view you should now be able to see your basemap in a page generated by that view.
Thursday, February 4, 2010
Migrating ArcIMS to a new machine
1. Install Apache (2.2.x, to c:\Apache2.2\, in my case) and Tomcat (6.0.x, to c:\Tomcat6.0\, in my case) make sure each is able to launch independently. You might need to install Java JDK and set environment variables JAVA_HOME and JRE_HOME to the JDK directory
2. Download mod_jk (1.2.28 httpd-2.2.3, in my case). Install by dragging mod_jk-xxx.so to the Apache modules folder and renaming mod_jk.so. Add this line to httpd.conf: LoadModule jk_module modules/mod_jk.so
3. Add a workers.properties file to the apache conf directory. This file sets options for your ajp (probably ajp13). Make sure it points to your JDK, Tomcat home directory, etc.
4. Install ArcIMS with the 'custom' option during post-install. Make sure that you select the JDK you already installed.
5. Copy over old aimsacl.xml from webapps\servlet\WEB-INF\classes. Give * permissions to all your apps for testing, you can change later if necessary
6. Copy over old old apps from the Tomcat webapps directory. Make sure WEB-INF\classes\Authenticate.properties is pointing to the new aimsacl.xml
7. Use AIMS administrator to set up map service, using similiar settings as old service. Note: on my install 'Output', 'Website', and 'Axl' are all under the Apache htdocs directory
8. Add all applicable webapps directories to httpd.conf as in the following (substituting 'example' for your own app):
JkMount /example ajp13
JkMount /example/* ajp13
9. Change any connection properties in your webapps to match new machine
10. Restart Apache, Tomcat, enjoy.
2. Download mod_jk (1.2.28 httpd-2.2.3, in my case). Install by dragging mod_jk-xxx.so to the Apache modules folder and renaming mod_jk.so. Add this line to httpd.conf: LoadModule jk_module modules/mod_jk.so
3. Add a workers.properties file to the apache conf directory. This file sets options for your ajp (probably ajp13). Make sure it points to your JDK, Tomcat home directory, etc.
4. Install ArcIMS with the 'custom' option during post-install. Make sure that you select the JDK you already installed.
5. Copy over old aimsacl.xml from webapps\servlet\WEB-INF\classes. Give * permissions to all your apps for testing, you can change later if necessary
6. Copy over old old apps from the Tomcat webapps directory. Make sure WEB-INF\classes\Authenticate.properties is pointing to the new aimsacl.xml
7. Use AIMS administrator to set up map service, using similiar settings as old service. Note: on my install 'Output', 'Website', and 'Axl' are all under the Apache htdocs directory
8. Add all applicable webapps directories to httpd.conf as in the following (substituting 'example' for your own app):
JkMount /example ajp13
JkMount /example/* ajp13
9. Change any connection properties in your webapps to match new machine
10. Restart Apache, Tomcat, enjoy.
Monday, January 25, 2010
json_encode pg_fetch_array
For some reason you need to run the result of pg_fetch_array through a loop and store in another array to be able to encode as JSON ... here's an example:
// Connecting, selecting database
$dbconn = pg_connect("host=HOSTNAME dbname=DBNAME user=DBUSER password=PASSWORD")
or die('Could not connect: ' . pg_last_error());
// Performing SQL query
$query = "SELECT * FROM mytable";
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
$resultArray = array();
while ($row = pg_fetch_array($result, null, PGSQL_ASSOC)) {
$resultArray[] = $row;
}
echo json_encode($resultArray);
// Free resultset
pg_free_result($result);
// Closing connection
pg_close($dbconn);
// Connecting, selecting database
$dbconn = pg_connect("host=HOSTNAME dbname=DBNAME user=DBUSER password=PASSWORD")
or die('Could not connect: ' . pg_last_error());
// Performing SQL query
$query = "SELECT * FROM mytable";
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
$resultArray = array();
while ($row = pg_fetch_array($result, null, PGSQL_ASSOC)) {
$resultArray[] = $row;
}
echo json_encode($resultArray);
// Free resultset
pg_free_result($result);
// Closing connection
pg_close($dbconn);
Subscribe to:
Posts (Atom)