Archive

Archive for February, 2007

OpenLayers and Google Layer Zoom fix

February 20th, 2007 rupert Comments off

I have finally fixed the disappearing layer on the layer switch when we try to overlay the layer on top of Google. I edited Google.js to reflect the ff:

 
    MAX_ZOOM_LEVEL: 22,
 
    /** Hardcode these resolutions so that they are more closely
     *   tied with the standard wms projection
     *
     * @final @type Array(float) */
/*    RESOLUTIONS: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125],*/
 
RESOLUTIONS:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.0000214576721191140625,0.000107288360595703125,0.0000053644182978515625,0.000002682209014892578125,0.0000013411045074462890625,0.00000067055225372314453125],
Categories: openlayers Tags: ,

Mapinfo8 MySQL5 Connection

February 20th, 2007 rupert Comments off

I only tried this using point objects.

1. Download and install MyODBC3.5.1

2. Create database mapinfotest

3. Create the mapinfo_mapcatalog table as follows:

CREATE TABLE `mapinfo_mapcatalog` (
`SpatialType` float NOT NULL default '0',
`TableName` char(32) NOT NULL default '',
`OwnerName` char(32) NOT NULL default '',
`SpatialColumn` char(32) NOT NULL default '',
`DB_X_LL` float NOT NULL default '0',
`DB_Y_LL` float NOT NULL default '0',
`DB_X_UR` float NOT NULL default '0',
`DB_Y_UR` float NOT NULL default '0',
`CoordinateSystem` char(254) NOT NULL,
`Symbol` char(254) NOT NULL default '',
`XColumnName` char(32) NOT NULL default '',
`YColumnName` char(32) NOT NULL default '',
PRIMARY KEY (`TableName`,`OwnerName`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

4. create a sample table with two (2) decimal columns for the latitude and longitude.

CREATE TABLE `poi_orig2` (
`poiid` decimal(10,0) unsigned NOT NULL default '0',
`id` char(10) NOT NULL default '',
`py_name` char(255) character set utf8 default NULL,
`latitude` decimal(20,8) default '0.00000000',
`longitude` decimal(20,8) default '0.00000000',
PRIMARY KEY (`poiid`,`id`)
)

5. Open Mapinfo 8
6. File -> Open DBMS Connection

7. Table > Maintenance > Make DBMS Table Mappable

Fill up the necessary values for the x,y and the index column.

You need to choose an index column so Mapinfo could update the record/s in MySQL, normally it would be an ID. Once successful you should be able to see the success window…

8. Open the table

Click on the upper right corner to open a dbms connection. After selecting the datasource (mine is system) then it would give you a list of tables to choose from.

Categories: mapinfo Tags: ,

TileCache Experiment

February 16th, 2007 rupert Comments off

I am now able to do tilecache using TileCache1.3 from metacarta. Base from archives (archive-user.txt)

From crschmidt at metacarta.com  Wed Nov 22 17:54:29 2006
From: crschmidt at metacarta.com (Christopher Schmidt)
Date: Wed, 22 Nov 2006 17:54:29 -0500
Subject: [OpenLayers-Users] TileCache - Tiling issues
In-Reply-To: <4564D326.6020607@refractions.net>
References: <4564D326.6020607@refractions.net>
Message-ID: <20061122225429.GA18180@metacarta.com>
 
On Wed, Nov 22, 2006 at 02:45:58PM -0800, Ben Brehmer wrote:
> Hello everyone,
>
> I have setup a basic OpenLayers application with TileCache doing the
> server-side caching. I was wondering if there is a way to pre-cache all
> the tiles (besides panning/zooming everywhere on the map)? I know in
> kamap there is a script that can be run to pre-cache all the tiles. Is
> there something similair for TileCache?
 
In the TileCache directory, there is a 'Client.py' script. To pre-cache
your data, use it in the following manner:
 
python Client.py "http://example.com/tilecachelocation/tilecache.cgi?"
"layername" startzoomlevel endzoomlevel [BBOX]
 
Something like:
 
python Client.py "http://labs.metacarta.com/wms-c/Basic.py?" "basic" 0 16
 
Is what we used to precache all of the Vmap0 data in the MetaCarta VMap0
layer.
 
> Also, I have attached two jpegs. Each has part of a symbol or label
> chopped off. I believe that the "chopping" occurs at the edge of a tile.
> Has anyone ever experience something like this in OpenLayers?
 
This is based on your Mapserver setup, rather than something specific in
OpenLayers. Using WMS would result in the same visual result. Labels can
have this prevented using the "PARTIALS OFF" on your label layer, if
you're using Mapserver. I'm not aware of a way to prevent this in symbol
generation. 
 
We are currently working on ka-map style rendering to add to TileCache,
to help people not run into this issue. No timeframe available yet on
when that'll be released. 
 
Regards,
--
Christopher Schmidt
MetaCarta

1. TileCache Configuration: tilecache.cfg

[cache]
type=DiskCache
base=E:\\usr\\local\\apache2\\htdocs\\tmp\\
 
[basemap]
type=WMSLayer
url=http://127.0.0.1/cgi-bin/mapserv.exe?map=/home/basemap/wmstest_longlat.map
layers=district,greens,major_river,minor_river
extension=png
 
[roads]
type=WMSLayer
url=http://127.0.0.1/cgi-bin/mapserv.exe?map=/home/basemap/wmstest_longlat.map
layers=road4,road4label,road3,road3label,road2,road2label,road1,road1label,road11,road11label
extension=png

2. Calling CFM Script: Test.cfm

    <cfset request.mapserv="http://127.0.0.1/tilecache/tilecache.py"> 
 
    <script src="/OpenLayers-2.2/lib/OpenLayers.js"></script>
    <script type="text/javascript"></script>
        <!--<br /-->        //var lon = 116.3842;
        //var lat = 39.9150;
        var lon = 116.3846;
        var lat = 39.9202;
        var zoom = 16;
        var map, markers;
 
        function init(){
      	    map = new OpenLayers.Map( $('map'), { maxResolution: 'auto'});
 
	    var layer_base = new OpenLayers.Layer.WMS(
					"Base Layer",
					"#request.mapserv#",
					{
						layers: 'basemap',
						format: 'png', 'transparent': 'off'
					}
					);
 
                map.addLayer(layer_base);
	   layer_base.setIsBaseLayer(true);	
 
               ...more code here...
 
       }
</cfset>

I want to fine tune this script since I am getting odd tiles like duplicate tiles or tiles shown of different scale on the same scale.

3. Precaching:
/d/Python24/python.exe Client.py “http://127.0.0.1/tilecache/tilecache.py” “roads” 14 16 116.35397,39.88984,116.42988,39.91918

I need to understand the “cache hit” or “cache miss” during execution.

Categories: mapserver, tilecache Tags: ,

Writing CFCs using UML with Poseidon

February 4th, 2007 rupert Comments off

It seems the xmi2cfc tool from cfcxmi.tigris.org works only for Poseidon 2.x versions. The visio works well and poseidon can export the xmi as well but I still encounter problems during the xmi to cfc conversion.

I just bought a 1GB ram for my notebook since Poseidon peaks at 200MB. How to create cfc’s with Poseidon?

1. Download and install Poseidon. Im using Poseidon 5 Professional.
2. Download the poseidon custom templates from http://cfcxmi.tigris.org/.
3. Extract it to Poseidon/lib/. You should have the ff directories:

Poseidon/
lib/
custom/

4. Start poseidon
5. Click on “Generation” -> “Java”
6. Click on the ellipses tool and point to the custom templates.
7. “Apply” the settings.
8. Create your class
9. Click on the source code to view your cfc.

I have made some changes to the templates to reflect the output=”false” and required=”true”. You can download the templates from here.

Categories: coldfusion Tags: , ,

ColdSpring bean creation magic…

February 1st, 2007 rupert Comments off

Adam describes some fun and exciting changes in ModelGlue Unity. I can now ditch cflocation by using argument.event.forward(“location.cfm”).

Its just now that im loving ColdSpring, I think its much better to instantiate beans and set/create other objects using setters/getters through the property instead of constructor-arg. Here’s an example:

<cfcomponent displayname="UserService" output="false" hint="I am a UserService.">
	<cffunction name="init" access="Public" returntype="UserService" output="false" hint="I am a new UserService">
		<cfreturn>
	</cfreturn>
 
	</cffunction><cffunction name="setUserGateway" returntype="void" access="public" output="false" hint="Dependency: UserService">
		<cfargument name="userGateway" type="cfcodetrack.model.UserGateway" required="true">
		<cfset variables.usergateway="arguments.userGateway">
	</cfset>
 
	<cffunction name="getUserGateway" access="public" returntype="cfcodetrack.model.UserGateway" output="false">
		<cfreturn>
	</cfreturn>	
 
	</cffunction><cffunction name="authenticate" access="public" returntype="string" output="false">
		<cfargument name="username" type="string" required="true">
		</cfargument><cfargument name="password" type="string" required="true">
		<cfdump var="#password#">
		<cfabort>
	</cfabort>	
 
	<cffunction name="getUsers" access="public" returntype="any" output="false">
		<cfreturn>
	</cfreturn>
 
</cffunction>
</cfdump></cfargument></cffunction></cfargument></cffunction></cfcomponent>

In your ColdSpring.xml your beans should only look like this:

	<bean id="dsn" class="cfcodetrack.model.dsn">
		<constructor -arg name="dsn">
			<value>cfcodetrack</value>
		</constructor>
	</bean>	
 
	<bean id="reactorFactory" class="reactor.reactorFactory">
		<constructor -arg name="configuration">
			<ref bean="reactorConfiguration">
		</ref>
	</constructor>
 
	<!-- Security Service
	-->
	</bean><bean id="securityService" class="cfcodetrack.model.SecurityService" singleton="true"></bean>
 
	<bean id="userGateway" class="cfcodetrack.model.UserGateway" singleton="true">
<property name="reactorFactory">
			<ref bean="reactorFactory">
		</ref>
</property><property name="dsn">
			<ref bean="dsn">
		</ref>
	</property>
 
	</bean><bean id="userService" class="cfcodetrack.model.UserService" singleton="true">
<property name="userGateway">
			<ref bean="userGateway">
		</ref>
	</property>
</bean>
Categories: Uncategorized Tags: ,