[Geomoose-users] PGDB mdb query.php

Len Kne lkne at houstoneng.com
Mon Jul 12 17:35:02 EDT 2010


Hi Mike

Looks like it might be a bug.  I was able to get an OGR layer to work in the query when I forced it to use the SQL query string instead of the MapServer regular expression.  You could try adding this line 

	$is_sql = true;

Just above
	
	if($is_sql) {  (should be line 292)

Let me us know if that works for you and we can add a request to trac.

Len

-----Original Message-----
From: Reynolds, Michael J. (DOT) [mailto:Mike.Reynolds at state.mn.us] 
Sent: Monday, July 12, 2010 2:24 PM
To: Len Kne; geomoose-users at lists.sourceforge.net
Subject: RE: PGDB mdb query.php

Len, thanks for the suggestions.  I removed the layer name="all" and adjusted the error reporting and received the following error messages:

With error_reporting(E_ERROR | E_PARSE); in query.php the following error occurs:
"Fatal error: Object expected as argument. in C:\ms4w\apps\metrogis\htdocs\php\query.php  on line 318"

With error_reporting(E_ERROR | E_PARSE); commented out in query.php the following error occurs:
"Warning: [MapServer Error]: msShapefileOpen(): (/ms4w/apps/metrogis/maps/mapfiles_metro/assets/SELECT OBJECTID, SHAPE, SYSTEM_ID, CABINET_ID, LAYOUT_URL, CABINET_TYPE, CABINET_VOLTS, ROADWAY_NAME, LOCATION, QUAD, METER_VENDOR, METER_ACCOUNT, METER_ADDRESS, METER_NBR, PREMISE_NBR, OWNER_CODE, SHARED_POWER_CSV, format(DATE_LOGGED,'mm/dd/yyyy') AS CDATE_LOGGED, format(DATE_INSTALLED, 'mm/dd/yyyy') AS CDATE_INSTALLED, format(DATE_TURNON, 'mm/dd/yyyy') AS CDATE_TURNON, format(DATE_RETIRED, 'mm/dd/yyyy') AS CDATE_RETIRED, GEOMSRC_CODE FROM LIGHT_CABINETS WHERE (DATE_TURNON < date() OR DATE_TURNON Is NULL) AND (DATE_RETIRED > date() OR DATE_RETIRED Is NULL)) in C:\ms4w\apps\metrogis\htdocs\php\query.php on line 318"

Obviously, this example is based on a map file with a select statement.  I've switched to a basic map file with a simple mdb file reference and a feature class name.  Similar error; it appends the map file folder to the table name which is not something, it would seem, that mapserver (or ogr?) can access and search.  I'm not sure how to adjust the query.php to assign the proper connectiontype, connection, and data values.

FYI line 318 query.php:
$queryLayer->queryByRect($queryLayer->getExtent());

The <map-source>:
  <map-source name="traffic_lighting_systems_pgdb" type="mapserver" reference="false">
      <file>/ms4w/apps/metrogis/maps/mapfiles_metro/assets/traffic_lighting_systems_pgdb.map</file>
      <layer name="Poles"/>
      <layer name="Cabinets"/>
      <layer name="Utilities"/>
      <layer name="Junctions"/>
      <layer name="PowerSources"/>
  </map-source>

The part of the map file:
  LAYER
    EXTENT 424000 4927000 546000 5064000
    #EXTENT 0 0 1000000 10000000
    NAME 'Cabinets'
    CONNECTIONTYPE ogr
    CONNECTION '\\ad\metro\roseville\data\traffic\gis\mte_systems.mdb'
    DATA "SELECT OBJECTID, SHAPE, SYSTEM_ID, CABINET_ID, LAYOUT_URL, CABINET_TYPE, CABINET_VOLTS, ROADWAY_NAME, LOCATION, QUAD, METER_VENDOR, METER_ACCOUNT, METER_ADDRESS, METER_NBR, PREMISE_NBR, OWNER_CODE, SHARED_POWER_CSV, format(DATE_LOGGED,'mm/dd/yyyy') AS CDATE_LOGGED, format(DATE_INSTALLED, 'mm/dd/yyyy') AS CDATE_INSTALLED, format(DATE_TURNON, 'mm/dd/yyyy') AS CDATE_TURNON, format(DATE_RETIRED, 'mm/dd/yyyy') AS CDATE_RETIRED, GEOMSRC_CODE FROM LIGHT_CABINETS WHERE (DATE_TURNON < date() OR DATE_TURNON Is NULL) AND (DATE_RETIRED > date() OR DATE_RETIRED Is NULL)"
#    DATA "LIGHT_CABINETS"


The <service>:
  <service name="search_lighting_cabinet">
      <url>php/query.php</url>
      <step type="input">
        <input type="hidden" name="highlight" value="true"/>
        <input type="hidden" name="mode" value="search"/>
  
        <input type="hidden" name="layer0" value="traffic_lighting_systems_pgdb/Cabinets"/>
        <input type="hidden" name="template0" value="query"/>
        <input type="hidden" name="fieldname0" value="CABINET_ID"/>
        <input type="select" name="fieldname0" title="Search By:">
          <option value="CABINET_ID">Cabinet ID</option>
          <option value="SYSTEM_ID">System ID</option>
        </input>
        <input type="select" name="comparitor0" title="That: ">
          <option value="like-icase">Contains</option>
          <option value="right-like-icase">Begins With</option>
          <option value="eq-str">Matches Exactly</option>
        </input>
        <input type="user" name="value0" title=""/>
        <input name="visiblelayers0" type="visiblelayers" value="traffic_lighting_systems_pgdb/Cabinets"/>
      </step>
  </service>


-----Original Message-----
From: Len Kne [mailto:lkne at houstoneng.com]
Sent: Monday, July 12, 2010 1:59 PM
To: Reynolds, Michael J. (DOT); geomoose-users at lists.sourceforge.net
Subject: RE: PGDB mdb query.php

I've not tried using a PGDB in the query service, but a couple things to try:

1. Comment out error_reporting(E_ERROR | E_PARSE); to see if more warning messages are popping up 2. Try removing the "All" layer name from the map-source since you have the layers defined below it.

Len

-----Original Message-----
From: Reynolds, Michael J. (DOT) [mailto:Mike.Reynolds at state.mn.us]
Sent: Sunday, July 11, 2010 4:39 PM
To: geomoose-users at lists.sourceforge.net
Subject: [Geomoose-users] PGDB mdb query.php

Wondering if any users can confirm or deny that a search tool using query.php and a map file with a data connection to a personal geodatabase (.mdb) will work.

I'm using GeoMoose 2.0.

I'm struggling to set this search tool up in my environment. 

The layer's map file settings are:
    NAME 'Cabinets'
    CONNECTIONTYPE ogr
    CONNECTION '\\ad\metro\roseville\data\traffic\gis\mte_systems.mdb'
    DATA "SELECT OBJECTID, SHAPE, SYSTEM_ID, CABINET_ID, LAYOUT_URL, CABINET_TYPE, CABINET_VOLTS, ROADWAY_NAME, LOCATION, QUAD, METER_VENDOR, METER_ACCOUNT, METER_ADDRESS, METER_NBR, PREMISE_NBR, OWNER_CODE, SHARED_POWER_CSV, format(DATE_LOGGED,'mm/dd/yyyy') AS CDATE_LOGGED, format(DATE_INSTALLED, 'mm/dd/yyyy') AS CDATE_INSTALLED, format(DATE_TURNON, 'mm/dd/yyyy') AS CDATE_TURNON, format(DATE_RETIRED, 'mm/dd/yyyy') AS CDATE_RETIRED, GEOMSRC_CODE FROM LIGHT_CABINETS WHERE (DATE_TURNON < date() OR DATE_TURNON Is NULL) AND (DATE_RETIRED > date() OR DATE_RETIRED Is NULL)"

The mapfile <map-source> entry is:

  <map-source name="traffic_lighting_systems_pgdb" type="mapserver" reference="false">
      <file>/ms4w/apps/metrogis/maps/mapfiles_metro/assets/traffic_lighting_systems_pgdb.map</file>
      <layer name="all"/>
      <layer name="Poles"/>
      <layer name="Cabinets"/>
      <layer name="Utilities"/>
      <layer name="Junctions"/>
      <layer name="PowerSources"/>
  </map-source> 

Note that this layer 

The <Service> is:

<service name="search_lighting_cabinet">
			<url>php/query.php</url>
			<step type="input">
				<input type="hidden" name="highlight" value="true"/>
				<input type="hidden" name="mode" value="search"/>
	
				<input type="hidden" name="layer0" value="traffic_lighting_systems_pgdb/Cabinets"/>
				<input type="hidden" name="template0" value="query"/>
				<input type="hidden" name="fieldname0" value="CABINET_ID"/>
				<input type="select" name="fieldname0" title="Search By:">
					<option value="CABINET_ID">Cabinet ID</option>
					<option value="SYSTEM_ID">System ID</option>
				</input>
				<input type="select" name="comparitor0" title="That: ">
					<option value="like-icase">Contains</option>
					<option value="right-like-icase">Begins With</option>
					<option value="eq-str">Matches Exactly</option>
				</input>
				<input type="user" name="value0" title=""/>
			</step>
	</service>

This layer renders great from the catalog and identify is working fine. The long layer select sql works great.  When I use the search service above from a menu tool, the information panel fills with the search form and I can enter search criteria.  When I hit the search button I get the following error:

Warning: [MapServer Error]: msShapefileOpen(): (/ms4w/apps/metrogis/maps/mapfiles_metro/assets/SELECT OBJECTID, SHAPE, SYSTEM_ID, CABINET_ID, LAYOUT_URL, CABINET_TYPE, CABINET_VOLTS, ROADWAY_NAME, LOCATION, QUAD, METER_VENDOR, METER_ACCOUNT, METER_ADDRESS, METER_NBR, PREMISE_NBR, OWNER_CODE, SHARED_POWER_CSV, format(DATE_LOGGED,'mm/dd/yyyy') AS CDATE_LOGGED, format(DATE_INSTALLED, 'mm/dd/yyyy') AS CDATE_INSTALLED, format(DATE_TURNON, 'mm/dd/yyyy') AS CDATE_TURNON, format(DATE_RETIRED, 'mm/dd/yyyy') AS CDATE_RETIRED, GEOMSRC_CODE FROM LIGHT_CABINETS WHERE (DATE_TURNON < date() OR DATE_TURNON Is NULL) AND (DATE_RETIRED > date() OR DATE_RETIRED Is NULL)) in C:\ms4w\apps\metrogis\htdocs\php\query.php on line 318

I find it odd that "/ms4w/apps/metrogis/maps/mapfiles_metro/assets/" is prefixed to the select or data value.  Shouldn't the database location and name be somewhere in there?  

I have tried keeping the data value a simple table/feature class name to rule that out.  Still an error.

I've tried navigating the query.php (geomoose 2.0) but I can't seem to make heads or tails of it.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Geomoose-users mailing list
Geomoose-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geomoose-users




More information about the Geomoose-users mailing list