[mapserver-users] ogr csv layer in mapserver

2012-03-06 Thread Murat Beyhan
Dear all,

I used gdal 1.7.2 and mapserver 5.2.1

I try to draw layer which data csv file as follows

filename : kyh_sta_ogr.csv

ID,STA_ID,Latitude,Longitude
1,0104,37.02403,35.80947
2,0118,37.02100,35.19100
.
.
.


then I use ogr for reading data from that file as follows and map file
also here



LAYER
  NAME kyh_vrt_ogr
   CONNECTIONTYPE OGR
   CONNECTION 'OGRVRTDataSource
OGRVRTLayer name=kyh_sta_ogr
SrcDataSourcekyh_sta_ogr.csv/SrcDataSource
GeometryTypewkbPoint/GeometryType
LayerSRSWGS84/LayerSRS
GeometryField encoding=PointFromColumns x=Longitude
y=Latitude/
/OGRVRTLayer
/OGRVRTDataSource' 
DATA kyh_sta_ogr
STATUS default
TYPE POINT
  CLASS
NAME kyh
SYMBOL cpoint
SIZE 1
COLOR 0 0 0
  END
END  

Please let me inform what is wrong in my code and why always trouble to
draw ogr layer in mapserver.
mapserver gives following error message

msDrawMap(): Image handling error. Failed to draw layer named
'kyh_vrt_ogr'. msOGRFileOpen(): OGR error. Open failed for OGR
connection in layer `kyh_vrt_ogr'. Failed to open datasource
`kyh_sta_ogr.csv'.
  


but command 
ogrinfo -ro -al kyh.vrt 
as follows:

ogrinfo -ro -al kyh.vrt
INFO: Open of `kyh.vrt'   
  using driver `VRT' successful.  

Layer name: kyh_sta_ogr
Geometry: Point
Feature Count: 327 
Layer SRS WKT: 
GEOGCS[WGS 84,   
DATUM[WGS_1984,  
SPHEROID[WGS 84,6378137,298.257223563,
AUTHORITY[EPSG,7030]],  
TOWGS84[0,0,0,0,0,0,0], 
AUTHORITY[EPSG,6326]],  
PRIMEM[Greenwich,0,   
AUTHORITY[EPSG,8901]],  
UNIT[degree,0.0174532925199433,   
AUTHORITY[EPSG,9108]],  
AUTHORITY[EPSG,4326]]   
ID: String (0.0)
STA_ID: String (0.0)
Latitude: String (0.0)  
Longitude: String (0.0) 
OGRFeature(kyh_sta_ogr):1   
  ID (String) = 1   
  STA_ID (String) = 0104
  Latitude (String) = 37.02403  
  Longitude (String) = 35.80947 
  POINT (35.8094697 37.0240303) 

OGRFeature(kyh_sta_ogr):2
  ID (String) = 2
  STA_ID (String) = 0118 
  Latitude (String) = 37.02100
  Longitude (String) = 35.19100
  POINT (35.1910003 37.021)

 


Murat BEYHAN 

Jeofizik Y.Müh.
T.C. Başbakanlık
Afet ve Acil Durum Yönetimi Başkanlığı
Deprem Dairesi Başkanlığı
Eskişehir Yolu 12. Km.
Lodumlu/ANKARA
Tel: 312 2872680-1556
email:bey...@deprem.gov.tr




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] spatial filter DWITHIN unsucessful

2012-03-06 Thread Neelima Emmani
Hi All,

I am working with openlayers, mapserver and post gis. I am facing problem with 
spatial filter DWITHIN and not able to discover if it is problem with mapserver 
or not.

Details

Now,
I have google map as a base map and overlayed few point layers. Now, i want to 
do filtering with respect to the path that's drew on the map. For this path , i 
am using  draw feature with OpenLayers.Handler.Path. Upto here it is working 
fine. I can draw a line. Now using the line geometry ,  i am giving a spatial 
filter DWITHIN with a distance of  2000 and also mentioned distanceUnits as  
'm'. After i draw a line , the spatial filter for DWITHIN gets activated and 
the layer to be filtered is completely disappearing. Now what i found is, it is 
throwing a WFS exception as below -

msWFSGetFeature(): WFS server error. Invalid or Unsupported FILTER in 
GetFeature :
(lt;ogc:Filter 
xmlns:ogc=quot;http://www.opengis.net/ogcquot;gt;lt;ogc:Andgt;lt;ogc:DWithingt;lt;ogc:PropertyNamegt;the_geomlt;/ogc:PropertyNamegt;lt;gml:MultiLineString
 xmlns:gml=quot;http://www.opengis.net/gmlquot; 
srsName=quot;EPSG:900913quot;gt;lt;gml:lineStringMembergt;lt;gml:LineStringgt;lt;gml:coordinates
 decimal=quot;.quot; cs=quot;,quot; ts=quot; 
quot;gt;-79.205932617188,32.309033345029 -79.458618164063,32.267239420261 
-79.851379394531,32.144067753448 
-78.255615234375,33.130344611623lt;/gml:coordinatesgt;lt;/gml:LineStringgt;lt;/gml:lineStringMembergt;lt;/gml:MultiLineStringgt;lt;ogc:Distance
 
units=quot;mquot;gt;20lt;/ogc:Distancegt;lt;/ogc:DWithingt;lt;ogc:BBOXgt;lt;ogc:PropertyNamegt;the_geomlt;/ogc:PropertyNamegt;lt;gml:Box
 xmlns:gml=quot;http://www.opengis.net/gmlquot; 
srsName=quot;EPSG:4326quot;gt;lt;gml:coordinates decimal=quot;.quot; 
cs=quot;,quot; ts=quot; quot;gt;-84.100341796875,29.910254

 244941 
-73.114013671875,34.556260876457lt;/gml:coordinatesgt;lt;/gml:Boxgt;lt;/ogc:BBOXgt;lt;/ogc:Andgt;lt;/ogc:Filtergt;

And then I checked with get Capabilities , It is spatial filter DWITHIN 
capable. After that I checked by copying my WFS layer url along with filter 
properties as below -

http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/openlayers-2.10/examples/us1gc09m-addline.mapSERVICE=WFSVERSION=1.0.0REQUEST=GetFeatureTYPENAME=us1gc09mFilter=%3CFilter%3E%3CDWithin%3E%3CPropertyName%3Ethe_geom%3C/PropertyName%3E%3Cgml:Point%3E%3Cgml:coordinates%3E-80.22217%2031.07991%3C/gml:coordinates%3E%3C/gml:Point%3E%3CDistance%20units=%27m%27%3E100%3C/Distance%3E%3C/DWithin%3E%3C/Filter%3E

into a browser. With this, It works well. No exception is thrown and the query 
is done properly. So, now, i do not understand where is the problem lies.

Can any one tell me how to solve this. How to do Spatial filter DWITHIN.  And 
is my approach right?
Below is my JS code ---

var map;
var spatialfilter;

function init() {
 map = new OpenLayers.Map(map);

//GOOGLE MAP
var base = new OpenLayers.Layer.Google(Google Hybrid, {'type': 
G_HYBRID_MAP});
map.addLayer(base);
//CREATE WMS LAYER
var wms = new OpenLayers.Layer.WMS(wms, 
http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/openlayers-2.10/examples/xyz.map;,
  {layers: 'xyz'}, {isBaseLayer: false, visibility: false, 
opacity: 0.5, singleTile: true});
map.addLayer(wms);

//VECTOR LAYER FOR PANEL
var vlayer = new OpenLayers.Layer.Vector(vlayer);
map.addLayer(vlayer);


// CREATE WFSLAYERS

//style map for points
var styleMap = new 
OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({fillColor: CYAN, 
fillOpacity: 1, strokeColor: black},
OpenLayers.Feature.Vector.style[default]));

// mock up a protocol for synchronous and successful commits
var wfs_protocol = new 
OpenLayers.Protocol.WFS({url:http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/openlayers-2.10/examples/xyz.mapSERVICE=WFSVERSION=1.0.0REQUEST=GetFeatureTYPENAME=xyz;,
featureType: xyz,
srsName: EPSG:900913});

var wfslayer = new OpenLayers.Layer.Vector(WFS, {styleMap: styleMap,
strategies: [new 
OpenLayers.Strategy.BBOX()],
protocol: wfs_protocol
});

map.addLayer(wfslayer);

map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.LayerSwitcher());
 //MAP CONTROLS
var defStyle = {strokeColor: red, strokeOpacity: 0.7, strokeWidth: 1, 
fillColor: red, pointRadius: 3, cursor: pointer};
var sty = OpenLayers.Util.applyDefaults(defStyle, 
OpenLayers.Feature.Vector.style[default]);


var DeleteFeature = OpenLayers.Class(OpenLayers.Control, {
initialize: function(layer, options) {
OpenLayers.Control.prototype.initialize.apply(this, [options]);
this.layer = layer;
this.handler = new OpenLayers.Handler.Feature(
this, layer, {click: 

[mapserver-users] WMS server layer trouble

2012-03-06 Thread Raffaele Morelli
Hi,

I can't get it working as desired and can't understand why.
Here is my wms online resource:
http://cen.isprambiente.it/cgi-bin/rf_mapserv?SERVICE=WMSVERSION=1.1.1REQUEST=GetCapabilities

If you try to load the layer sostegni in QGis you should get an image
size error, selecting the CEN-RF layer works but loads all the layer in
the mapfile.
The only layer I can import in QGis is the Data Elevation Model.

I would like my wms server to act like
http://demo.mapserver.org/cgi-bin/wms?SERVICE=WMSVERSION=1.1.1REQUEST=GetCapabilities

Any hints?
regards
-r

-- 
*L'unica speranza di catarsi, ammesso che ne esista una, resta affidata
all'istinto di ribellione, alla rivolta non isterilita in progetti, alla
protesta violenta e viscerale.*
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] ogr csv layer in mapserver

2012-03-06 Thread Murat Beyhan
The problem solved by giving full path of csv file in map file as
follows than it works thanks

   SrcDataSource/var/www/html/dynamic/kyh_sta_ogr.csv/SrcDataSource

thanks again
Murat

On Tue, 2012-03-06 at 09:56 +0200, Murat Beyhan wrote:
 Dear all,
 
 I used gdal 1.7.2 and mapserver 5.2.1
 
 I try to draw layer which data csv file as follows
 
 filename : kyh_sta_ogr.csv
 
 ID,STA_ID,Latitude,Longitude
 1,0104,37.02403,35.80947
 2,0118,37.02100,35.19100
 .
 .
 .
 
 
 then I use ogr for reading data from that file as follows and map file
 also here
 
 
 
 LAYER
   NAME kyh_vrt_ogr
CONNECTIONTYPE OGR
CONNECTION 'OGRVRTDataSource
 OGRVRTLayer name=kyh_sta_ogr
 SrcDataSourcekyh_sta_ogr.csv/SrcDataSource
 GeometryTypewkbPoint/GeometryType
 LayerSRSWGS84/LayerSRS
 GeometryField encoding=PointFromColumns x=Longitude
 y=Latitude/
 /OGRVRTLayer
 /OGRVRTDataSource' 
 DATA kyh_sta_ogr
 STATUS default
 TYPE POINT
   CLASS
 NAME kyh
 SYMBOL cpoint
 SIZE 1
 COLOR 0 0 0
   END
 END  
 
 Please let me inform what is wrong in my code and why always trouble to
 draw ogr layer in mapserver.
 mapserver gives following error message
 
 msDrawMap(): Image handling error. Failed to draw layer named
 'kyh_vrt_ogr'. msOGRFileOpen(): OGR error. Open failed for OGR
 connection in layer `kyh_vrt_ogr'. Failed to open datasource
 `kyh_sta_ogr.csv'.
   
 
 
 but command 
 ogrinfo -ro -al kyh.vrt 
 as follows:
 
 ogrinfo -ro -al kyh.vrt
 INFO: Open of `kyh.vrt'   
   using driver `VRT' successful.  
 
 Layer name: kyh_sta_ogr
 Geometry: Point
 Feature Count: 327 
 Layer SRS WKT: 
 GEOGCS[WGS 84,   
 DATUM[WGS_1984,  
 SPHEROID[WGS 84,6378137,298.257223563,
 AUTHORITY[EPSG,7030]],  
 TOWGS84[0,0,0,0,0,0,0], 
 AUTHORITY[EPSG,6326]],  
 PRIMEM[Greenwich,0,   
 AUTHORITY[EPSG,8901]],  
 UNIT[degree,0.0174532925199433,   
 AUTHORITY[EPSG,9108]],  
 AUTHORITY[EPSG,4326]]   
 ID: String (0.0)
 STA_ID: String (0.0)
 Latitude: String (0.0)  
 Longitude: String (0.0) 
 OGRFeature(kyh_sta_ogr):1   
   ID (String) = 1   
   STA_ID (String) = 0104
   Latitude (String) = 37.02403  
   Longitude (String) = 35.80947 
   POINT (35.8094697 37.0240303) 
 
 OGRFeature(kyh_sta_ogr):2
   ID (String) = 2
   STA_ID (String) = 0118 
   Latitude (String) = 37.02100
   Longitude (String) = 35.19100
   POINT (35.1910003 37.021)
 
  
 
 
 Murat BEYHAN 
 
 Jeofizik Y.Müh.
 T.C. Başbakanlık
 Afet ve Acil Durum Yönetimi Başkanlığı
 Deprem Dairesi Başkanlığı
 Eskişehir Yolu 12. Km.
 Lodumlu/ANKARA
 Tel: 312 2872680-1556
 email:bey...@deprem.gov.tr
 
 
 
 



Murat BEYHAN 

Jeofizik Y.Müh.
T.C. Başbakanlık
Afet ve Acil Durum Yönetimi Başkanlığı
Deprem Dairesi Başkanlığı
Eskişehir Yolu 12. Km.
Lodumlu/ANKARA
Tel: 312 2872680-1556
email:bey...@deprem.gov.tr




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] WMS server layer trouble

2012-03-06 Thread Rahkonen Jukka
Hi,

Look at the GetCapabilities and see if Mapserver is advertising the layer 
extents in reasonable way. I have a feeling that QGis is trying to zoom 
automatically to the layer extents by taking the layer extents and some default 
resolution and calculating WIDTH and HEIGHT by those too. If they are wrong in 
the GetCapabilities there can be troubles.
For example the layer fiumi_02 shows now quite a large extents,

Fiumi II, III, IV ordine fiumi_02 epsg:32632 -1.47304E7 -9997960.0 50.0 
9997960.0

OpenJUMP shows the layers better because it does not generate oversized WIDTH 
and HEIGHT.
Consider adding wms_bbox_extended true. It will help clients like OpenJUMP 
to zoom to layer extents with any supported srsName.
It could be easist and most safe to set the correct layer extenst manually in 
metadata.


-Jukka Rahkonen-


Raffaele Morelli  wrote:
Hi,

I can't get it working as desired and can't understand why.
Here is my wms online resource: 
http://cen.isprambiente.it/cgi-bin/rf_mapserv?SERVICE=WMSVERSION=1.1.1REQUEST=GetCapabilities

If you try to load the layer sostegni in QGis you should get an image size 
error, selecting the CEN-RF layer works but loads all the layer in the 
mapfile.
The only layer I can import in QGis is the Data Elevation Model.

I would like my wms server to act like
http://demo.mapserver.org/cgi-bin/wms?SERVICE=WMSVERSION=1.1.1REQUEST=GetCapabilities

Any hints?
regards
-r

--
L'unica speranza di catarsi, ammesso che ne esista una, resta affidata 
all'istinto di ribellione, alla rivolta non isterilita in progetti, alla 
protesta violenta e viscerale.
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] WMS server layer trouble

2012-03-06 Thread Raffaele Morelli
2012/3/6 Rahkonen Jukka jukka.rahko...@mmmtike.fi

 **
 Hi,

 Look at the GetCapabilities and see if Mapserver is advertising the layer
 extents in reasonable way. I have a feeling that QGis is trying to zoom
 automatically to the layer extents by taking the layer extents and some
 default resolution and calculating WIDTH and HEIGHT by those too. If they
 are wrong in the GetCapabilities there can be troubles.
 For example the layer fiumi_02 shows now quite a large extents,

 Fiumi II, III, IV
 ordine fiumi_02 epsg:32632 -1.47304E7 -9997960.0 50.0 9997960.0

 OpenJUMP shows the layers better because it does not generate oversized
 WIDTH and HEIGHT.
 Consider adding wms_bbox_extended true. It will help clients like
 OpenJUMP to zoom to layer extents with any supported srsName.
 It could be easist and most safe to set the correct layer extenst manually
 in metadata.


 -Jukka Rahkonen-


Thanks for fast replying, in the meanwhile I've added wms_extent to every
layer metadata (except for europe) and the error disappeared.
BTW I am going to try wms_bbox_extended too.

Regards
-r



-- 
*L'unica speranza di catarsi, ammesso che ne esista una, resta affidata
all'istinto di ribellione, alla rivolta non isterilita in progetti, alla
protesta violenta e viscerale.*
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] force labels to fit in polygons

2012-03-06 Thread Patricio Gigoux
You could generate a center point, there is a function that do it in
irregular shaped, and fit the label in it

Patricio Gigoux




El 05-03-2012 18:50, Stephen Woodbridge escribió:
 On 3/5/2012 4:44 PM, Mark Volz wrote:
 Hello,
 Is there a way to force labels to fit inside of a polygon, even if a
 polygon is irregularly shaped? I noticed that with POSITION AUTO labels
 are falling outside of my soils boundary.

 The short answer is no. It is an interesting problem, but it does not
 have a guaranteed result as the label might be too big to fit
 regardless. I am not even sure of the algorithm should be for
 something like this. There are a lot of parameters like:

 font
 font size
 wrapping the text
 changing the angle
 finding the longest line, arc or smooth polyline that fits withing the
 polygon and then have the text follow that line

 These are all computationally expensive to do on the fly while
 rendering. Ideally these should be worked out in advance then you can
 supply the attributes to the label via binding columns in the data.

 -SteveW
 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] RE: WMS for netcdf [SEC=UNCLASSIFIED]

2012-03-06 Thread teknocreator
I would be interested as well with *Armin*'s code suggestions/examples,
though I agree with Kathleen that this may not be a preferred approach.  I'd
like to cast a vote here to *Jukka* for being able to somehow alter the
raster bands with either variable substitution or else with changing the URL
parameters.  Most of our data thus far is only 3-dimensional (x, y, t) with
no height dimension.  So, it would be a desired feature to be able to easily
move through the time dimension by just being able to change the bands.  For
us at present, each band in a GRIB file is a different time period for the
same data.  

That being said, better long term solutions and moving towards OGC standards
for our data may be to devote our efforts to creating a WCS for our data or
preprocess the data so that the WMS time option can be used.

*Kathleen* - you may be interested in this project (if you haven't seen it
already) that deals directly with NetCDF with a WMS - ncWMS:
http://www.resc.rdg.ac.uk/trac/ncWMS/wiki/FrequentlyAskedQuestions.  Another
group I work with is adapting this software for another project which uses
NetCDF.

Thanks for others' replies!

Dave M



--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/WMS-for-netcdf-SEC-UNCLASSIFIED-tp4519496p4551035.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] force labels to fit in polygons

2012-03-06 Thread Stephen Woodbridge

Right, the problem has two parts:

1) determine potential candidate label points
2) see if the label fits given the constraints placed on how to draw it

This is NP hard problem because it not just a problem of labeling a 
single polygon you also have to deal with all the other labels on the 
map that you might collide with.


If you search automatic label placement in google you can read up on 
the problem and the solutions that are available. Mapserver uses a 
different scheme for doing label placement that is much faster because 
it does not try to optimize label placement, but rather gives you 
controls for how labels should be placed, like POSITION, ANGLE 
AUTO|FOLLOW, PROCESSING LABEL_NO_CLIP=ON, PRIORITY, WRAP, 
MINFEATURESIZE, MAXLENGTH, PARTIALS, etc.


By the way, PROCESSING LABEL_NO_CLIP=ON will fix the label point at 
the polygon center.


-SteveW

On 3/6/2012 6:13 AM, Patricio Gigoux wrote:

You could generate a center point, there is a function that do it in
irregular shaped, and fit the label in it

Patricio Gigoux




El 05-03-2012 18:50, Stephen Woodbridge escribió:

On 3/5/2012 4:44 PM, Mark Volz wrote:

Hello,
Is there a way to force labels to fit inside of a polygon, even if a
polygon is irregularly shaped? I noticed that with POSITION AUTO labels
are falling outside of my soils boundary.


The short answer is no. It is an interesting problem, but it does not
have a guaranteed result as the label might be too big to fit
regardless. I am not even sure of the algorithm should be for
something like this. There are a lot of parameters like:

font
font size
wrapping the text
changing the angle
finding the longest line, arc or smooth polyline that fits withing the
polygon and then have the text follow that line

These are all computationally expensive to do on the fly while
rendering. Ideally these should be worked out in advance then you can
supply the attributes to the label via binding columns in the data.

-SteveW
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Re: Re: force labels to fit in polygons

2012-03-06 Thread Mark Volz
Steve and Patricio,

Thank you for your response.  I went with Patricio's idea of labeling off a 
point.  Which should be alright unless a user is zoomed in close and cannot see 
the center of a polygon.


Mark Volz
GIS Specialist

Message: 2
Date: Mon, 05 Mar 2012 16:50:42 -0500
From: Stephen Woodbridge wood...@swoodbridge.com
Subject: Re: [mapserver-users] force labels to fit in polygons
To: mapserver-users@lists.osgeo.org
Message-ID: 4f553532.2060...@swoodbridge.com
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 3/5/2012 4:44 PM, Mark Volz wrote:
 Hello,
 Is there a way to force labels to fit inside of a polygon, even if a 
 polygon is irregularly shaped? I noticed that with POSITION AUTO 
 labels are falling outside of my soils boundary.

The short answer is no. It is an interesting problem, but it does not have a 
guaranteed result as the label might be too big to fit regardless. I am not 
even sure of the algorithm should be for something like this. There are a lot 
of parameters like:

font
font size
wrapping the text
changing the angle
finding the longest line, arc or smooth polyline that fits withing the polygon 
and then have the text follow that line

These are all computationally expensive to do on the fly while rendering. 
Ideally these should be worked out in advance then you can supply the 
attributes to the label via binding columns in the data.

-SteveW

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] draw line using mysql sahpe file

2012-03-06 Thread Murat Beyhan
Dear All,

For 2 weeks I struggled to draw simple line using mysql database in
order to collect to many lines and draw only desired one on the map I
followed many way but could not solve the problem

at the beginning of my work I stored start and end of the line point on
the database as a table on mysql then I try to draw it using ogr. but I
could not draw it.
Then I firs create shape file of lines than I store it on mysql spatial
database by following 

 ogr2ogr -f MySQL MySQL:testogr,user=root,password=password123
sfault1.shp -nln sfault -append -overwrite -lco GEOMETRY_NAME=SHAPE2
then structure of the table created by this command as follows:


OGR_FID  
int(11)
Yes 
NULL 
SHAPE2  
geometry
Yes 
NULL 
id  
decimal(1,0)
Yes 
NULL 
lon  
double(8,4)
Yes 
NULL 
lat  
double(7,4)
Yes 
NULL 
eq_id  
varchar(14)
Yes 
NULL 

same database testogr has a two another table which collect
geometry_column and spatial_ref_sys.

then I try to draw it on mapserver
then I succeeded but it draws all of the line stored in this table using
following map layer. 
LAYER
 NAME fault
 TYPE line
 STATUS default
   CONNECTIONTYPE OGR
   CONNECTION 'OGRVRTDataSource
   OGRVRTLayer name=sfault
SrcDataSourceMYSQL:testogr,user=root,password=password123,host=localhost,port=3306,tables=sfault/SrcDataSource
 /OGRVRTLayer
/OGRVRTDataSource' 
 
   DATA sfault
   
  CLASS
  NAME Kaynak Fay/Source Fault
   SYMBOL cline
   SIZE 3
   COLOR 255 0 0 
 END
 END

But I desire only one of them using eq_id column but when I make sql
statement as follows. I mean when I add sql statement it draws nothing.
But be sure same eq_id comes to map file correctly to draw point of
epicenter. There is no problem for it. Also I use EXPRESSION FOR CLASS
also it doesn't draw line on the map. Previous map draws all, following
draws nothing. How can I pass this handicap. Please let help me.
LAYER
 NAME fault
 TYPE line
 STATUS default
   CONNECTIONTYPE OGR
   CONNECTION 'OGRVRTDataSource
   OGRVRTLayer name=sfault
SrcDataSourceMYSQL:testogr,user=root,password=password123,host=localhost,port=3306,tables=sfault/SrcDataSource
SrcSQLSELECT eq_id from sfault where eq_id like  %eq_id% /SrcSQL
/OGRVRTLayer
/OGRVRTDataSource' 

   DATA sfault
#   CLASSITEM eq_id
  CLASS
#  EXPRESSION ([eq_id] EQ 'eq_id') !! this also doesn't work 
   NAME Kaynak Fay/Source Fault
   SYMBOL cline
   SIZE 3
   COLOR 255 0 0 
END
END


-- 
Murat BEYHAN
Geophysical Engineer, M.Sc.
Prime Ministry
Disaster and Emergency Management Presidency
Earthquake Department
Address: Eskisehir Yolu 12. Km.
Lodumlu/ANKARA
Tel: 312 2872680-1556
email:bey...@deprem.gov.tr



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users