lib/tasks/mapfile.rake in gb_mapfish_appserver-0.0.5 vs lib/tasks/mapfile.rake in gb_mapfish_appserver-0.0.6
- old
+ new
@@ -50,10 +50,11 @@
topic.minscale = @map.web.metadata['gb_minscale']
topic.main_layer = true if topic.main_layer.nil?
topic.save!
topic.topics_layers.destroy_all
+ topic.categories_topics.destroy_all
Layer.unused.destroy_all
SublayerGroup.unused.destroy_all
category = @map.web.metadata['gb_category'] || 'Uncategorized'
topic.categories << Category.find_or_create_by_title(category)
@@ -100,9 +101,14 @@
mlayer.data =~ /FROM ["']?(\w+)["']?/i
layer.table = $1
puts "Warning: Couldn't extract table name of layer '#{layer.name}' from data '#{mlayer.data}'" if layer.table.blank?
mlayer.data =~ /UNIQUE (\w+)/i
layer.pkey = $1 || 'oid'
+ elsif mlayer.connectiontype == MS_WMS
+ url = mlayer.getWMSFeatureInfoURL(@map, 0, 0, 10, "text/xml")
+ #extract necessary params
+ params = url.split(/[?&]/).select {|p| k,v=p.split('='); %w(LAYERS QUERY_LAYERS VERSION SRS CRS).include?(k) || k =~ /^https?:/ }
+ layer.table = "#{params.shift}?#{params.join('&')}"
end
#ident_fields+alias_fields
if mlayer.metadata.key?('wms_include_items')
layer.ident_fields = mlayer.metadata['wms_include_items'].gsub(/,\s+/, ',')