[Geomoose-users] TinyOWS question.

Brent Fraser bfraser at geoanalytic.com
Wed Sep 3 15:28:11 PDT 2014


Bobb,

It has been some time since I tried to integrate GeoMoose v2.6 editing 
with TinyOWS (2.5 years? really?). The two main problems I ran into were:

1. No inserts allowed by TinyOWS, only edit and delete (a bug; I'll look 
up the version.  hopefully fixed by now)
2. No display in one projection and store in another (a GeoMoose fix 
required, I think)

and of course difficulty setting up the config files because of 
terminology/name-space mapping between:
     - PostGIS (btw, only PostGIS supported by TinyOWS still?) ,
     - TinyOWS XML
     - OpenLayers API
     - GeoMoose Mapbook

I've attached the doc I had made (basically an edit of Dan's GeoServer 
doc), but no guarantee they are still valid (or ever were).

Best Regards,
Brent Fraser

On 9/3/2014 11:46 AM, Basques, Bob (CI-StPaul) wrote:
>
> All (and I'm told, specifically Brent . . .)
>
> We need a working example of a Mapfile for connecting to TinyOWS for 
> editing from GeoMOOSE.
>
> TinyOWS is throwing Schema errors on edit.
>
> Thanks
>
> Bobb
>
>
>
> _______________________________________________
> Geomoose-users mailing list
> Geomoose-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geomoose-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20140903/204b5594/attachment.html>
-------------- next part --------------
Using TinyOWS with GeoMOOSE
=============================

This is a basic walk-through of adding vector editing to a GeoMOOSE site using the WFS-T server TinyOWS and PostGIS (currently TinyOWS works only with PostGIS).  This is not meant to be comprehensive and the reader should have some knowledge of PostGIS.

Install TinyOWS
---------------

The best documentation on setting up TinyOWS comes from the TinyOWS project itself `TinyOWS Documentation <http://mapserver.org/trunk/tinyows/>`_.

An easy way to install and startup a fresh TinyOWS instance is to use the TinyOWS distribution on the MS4W site `TinyOWS Download <http://www.maptools.org/ms4w/index.phtml?page=downloads.html>`_.

Download the Places Layer from the Census Bureau
------------------------------------------------

We'll be using the standard Geomoose demo and enhancing it by adding a "Census Cities" layer of places.  First, we need some data.
Download the file `here <ftp://anonymous@ftp2.census.gov/geo/tiger/TIGER2010/PLACE/2010/tl_2010_27_place10.zip>`_.  This is the "place" file for the state of Minnesota.  "Places" are a Census terminology for incorporated cities, townships, and equivalents.

Install the Places Shapefile into PostGIS
-----------------------------------------
Create a new database in PostGIS called gis2 using template:template_postgis and Encoding:UTF8.

There are a few good methods for doing this, for example the command line tools `ogr2ogr` or `shp2pgsql`.   Whichever method is used, the layer should be named `census_cities` for the purposes of this example.

**TBD: use shp2pgsql

shp2pgsql -c -s 4269 tl_2010_27_place10.shp > census_cities.sql
psql -U postgres -d gis2 -f census_cities.sql


A typical `ogr2ogr` string will look similar to this::

	ogr2ogr -f PostgreSQL PG:"dbname=gis2 user=gis password=super_gis" tl_2010_27_place10.shp tl_2010_27_place10 -nln census_cities -nlt MULTIPOLYGON -lco DIM=2

Configure TinyOWS
-----------------

Edit the TinyOWS config.xml
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Edit the C:\ms4w\apps\tinyows\config.xml

  <tinyows online_resource="http://127.0.0.1/cgi-bin/tinyows.exe"
    schema_dir="/ms4w/apps/tinyows/schema/"
    log="/ms4w/tmp/tinyows.log"
    log_level="15">
    <pg host="127.0.0.1" user="postgres" password="postgres" dbname="gis2" port="5432"/>
    <metadata name="TinyOWS Server" title="TinyOWS Server - Demo Service" />

    <layer retrievable="1"
	  writable="1"
	  ns_prefix="gis2"
	  ns_uri="http://127.0.0.1/cgi-bin/tinyows.exe"
	  name="censuscities"
	  srid="4269"
	  title="Census Cities" />
  </tinyows>

Note the 127.0.0.1 in the ns_uri should be changed to the name of your server. 

Check the config 

  set TINYOWS_CONFIG_FILE=/ms4w/apps/tinyows/config.xml
  C:\ms4w\apache\cgi-bin\tinyows --check
  
  NOTICE:  Function postgis_topology_scripts_installed() not found. Is topology support enabled and topology.sql installed?
  TinyOWS version:   1.0.0rc3
  FCGI support:      Yes
  Config File Path:  /ms4w/apps/tinyows/config.xml (TinyOWS XML)
  PostGIS Version:   2.0.1
  PostGIS dsn:       host=127.0.0.1 user=gis password=super_gis dbname=gis2 port=5432
  Output Encoding:   UTF-8
  Database Encoding: UTF8
  Schema dir:        /ms4w/apps/tinyows/schema/
  Display bbox:      Yes
  Estimated extent:  No
  Check schema:      Yes
  Check valid geoms: Yes
  Available layers:
   - public.census_cities (4269) -> gis2.census_cities [RW]  
  
  
Restart the TinyOWS service
^^^^^^^^^^^^^^^^^^^^^^^^^^^


GeoMoose Setup
--------------
Edit the geommose.html
^^^^^^^^^^^^^^^^^^^^^^
Add a reference to the data's SRS into the geommose.html::

	<script type="text/javascript" src="projections/EPSG4269.js"></script>

If it is not already there, you need to add the EPSG4269.js file to the projections folder. The file contains:

	Proj4js.defs["EPSG:4269"] = "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs";


Mapbook Setup
^^^^^^^^^^^^^
The Mapbook currently features a fragment which supports the above configuration of TinyOWS. Here is that fragement::

	<map-source name="census_cities" type="wfs" status="on" srs="EPSG:4269">
		<style type="stylemap"><![CDATA[
		{
			"strokeColor" : "#00ff00",
			"label" : "${name10}"
		}
		]]></style>

		<url>/cgi-bin/tinyows.exe</url>

		<attribute name="name10" type="text" label="Name:"/>
		<attribute name="aland10"      type="text" label="Area:" default-value="0"/>
		

		<feature-namespace>http://127.0.0.1/cgi-bin/tinyows.exe</feature-namespace>
		<feature-type>censuscities</feature-type>
		<geometry-name>wkb_geometry</geometry-name>
		<schema><![CDATA[http://127.0.0.1/cgi-bin/tinyows.exe?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=censuscities]]></schema>
	</map-source>


Uncomment the layer in the catalog portion of the mapbook


More information about the Geomoose-users mailing list