Hello Nadeem,has Robert merged my code for the spatial search to his enhanced search, the two original part of the widget dont use the same source for the spatial reference. The spatial search use the map spatial reference instead of the wkid set in the SearchWidget.xml. I'll report this problem to Robert, he will decide wich is the best solution.Erwan.
package com.esri.viewer.utils { public class GlobalVarContainer { public static var vars:Object = {}; public static var searchurl:String = "" ; } }
import com.esri.viewer.utils.GlobalVarContainer; //and within my function that specifies which map service and layer to display I try to pass the url //to the global variable searchurl for each (var item : LayerInfo in alllayers) { var lyrname:String = item.name; if (lyrname == qryname) { var lyrnum:String = item.id.toString(); var urlstr:String = lyr.url + "/" + lyrnum; GlobalVarContainer.searchurl = urlstr; visibleLayers.addItem(item.id); // add id }
import com.esri.viewer.utils.GlobalVarContainer; //and within private function init():void for (var i:Number = 0; i < lyrList.length(); i++) { //var lyrURL:String = lyrList.url; var lyrURL:String = GlobalVarContainer.searchurl;
<layer> <name>Parcels</name> <url>http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer/0</url> <expression useforspatial="true">PARCELID like '%[value]%'</expression> <textsearchlabel>Search by Parcel ID [ Example: 181001490000 ]:</textsearchlabel> <graphicalsearchlabel>Use one of the graphical search tools to select incidents</graphicalsearchlabel> <spatialsearchlabel>Select the two layers for spatial query</spatialsearchlabel> <spatialsearchlayer>true</spatialsearchlayer> <spatialrelationlayer>true</spatialrelationlayer> <titlefield>PARCELID</titlefield> <fields all="false"> <field name="PARCELID" alias="Parcel Id" gridfield="true"/> </fields> <linkfield></linkfield> <icon isfield="true"></icon> <zoomscale>40000</zoomscale> </layer>
All, A new version (2.1.6) is available that addresses most issues or enhancements requested.
<layer> <name>Owner Parcels</name> <url>http://gis.calhouncounty.org/ArcGIS2/rest/services/parcelviewer/MapServer/67</url> <expression useforspatial="false">upper(PPIN) = upper('[value]%')</expression> <textsearchlabel>Search Parcel by PPIN... [ Example: 1234 ]</textsearchlabel> <graphicalsearchlabel>Use one of the graphical search tools to select Parcel</graphicalsearchlabel> <spatialsearchlabel>Select the two layers for spatial query</spatialsearchlabel> <spatialsearchlayer>true</spatialsearchlayer> <spatialrelationlayer>true</spatialrelationlayer> <titlefield>NAME</titlefield> <fields all="false"> <field name="PPIN" gridfield="true" /> <field name="NAME" gridfield="true" /> <field name="STREET_ADDRESS" gridfield="true" /> <field name="USE_CODE" gridfield="true" /> <field name="CALC_ACRES" gridfield="true" /> <field name="EXEMPTION_CODE1" gridfield="true" /> <field name="ADDRESS_1" gridfield="true" gridfieldonly="true" /> <field name="ADDRESS_3" gridfield="true" gridfieldonly="true" /> <field name="PRIOR_TAX_YEAR" gridfield="true" /> <field name="SALE_DATE" gridfield="true" dateformat="MM/DD/YYYY"/> <field name="LAST_DEED_BOOK" gridfield="true"/> <field name="LAST_DEED_PAGE" gridfield="true"/> <field name="ZIPCODE_1" gridfield="true" gridfieldonly="true"/> <field name="NEIGHBORHOOD" gridfield="true" gridfieldonly="true"/> <field name="SUBDIVISION" gridfield="true"/> <field name="SALE_PRICE" gridfield="true" currencyformat="$|2|,|."/> <field name="TOTAL_TRUE" gridfield="true" currencyformat="$|2|,|." /> <field name="LAND_PRICE" gridfield="true" currencyformat="$|2|,|." /> <field name="IMPR_PRICE" gridfield="true" currencyformat="$|2|,|." /> <field name="ADJ_PRICE" gridfield="true" currencyformat="$|2|,|." /> <field name="OVER_COND" alias="PAPA Website Link" hyperlinkgridfield="true" hyperlinkaliastext="Click Here For PAPA Website" linkprefix="http://www.co.palm-beach.fl.us/PAPA/aspx/web/detail_info.aspx?p_entity=" linksuffix=""/> </fields> <linkfield linkprefix="http://www.co.palm-beach.fl.us/PAPA/aspx/web/detail_info.aspx?p_entity=" linksuffix="">OVER_COND</linkfield> <icon isfield="true"></icon> <zoomscale>5000</zoomscale> </layer>
//////////////////////////////////////////////////////////////////////////////// // // Version 1.0 - Nov 24, 2010 // // Delevoped by Robert Scheitlin // //////////////////////////////////////////////////////////////////////////////// package com.esri.viewer.utils { public class GlobalVarContainer { public var vars:Object = {}; public var searchurl:String = "" ; private static var _container:GlobalVarContainer; private static var _lock:Boolean = false; public static function getInstance():GlobalVarContainer { if (!_lock) { _container = new GlobalVarContainer(); _lock = true; } return _container; } } }
GlobalVarContainer.getInstance().searchurl = "Blah blah";
x = GlobalVarContainer.getInstance().searchurl;
queryGeom = map.extent; // select entities at screen extent
<bufferunits> <bufferunit> <name>UNIT_STATUTE_MILE</name> <label>Miles</label> </bufferunit> <bufferunit> <name>UNIT_FOOT</name> <label>Feet</label> </bufferunit> <bufferunit> <name>UNIT_METER</name> <label>Meters</label> </bufferunit> <bufferunit> <name>UNIT_KILOMETER</name> <label>Kilometers</label> </bufferunit> </bufferunits>
<layer> <name>Parcels-Current Taxyear</name> <url>http://gis.slco.org/wwwrest/services/public/Recorder/MapServer/4</url> <expression useforspatial="true">parcel_id LIKE upper('[value]%')</expression> <textsearchlabel>Search Parcel by Parcel ID... [ Example: 09333760080000]</textsearchlabel> <graphicalsearchlabel>Use one of the graphical search tools to select Parcel</graphicalsearchlabel> <spatialsearchlabel>Select the two layers for spatial query</spatialsearchlabel> <spatialsearchlayer>true</spatialsearchlayer> <spatialrelationlayer>true</spatialrelationlayer> <titlefield>parcel_id</titlefield> <fields all="false"> <field name="parcel_id" gridfield="true" /> </fields> <linkfield linkprefix="" linksuffix=""></linkfield> <icon isfield="true"></icon> <zoomscale>4000</zoomscale> </layer>
<widget label="Enhanced Search" left="60" top="400" icon="assets/images/i_search.png" config="widgets/eSearch/SearchWidget.xml" url="widgets/eSearch/SearchWidget.swf"/>
Barbara, Try this//////////////////////////////////////////////////////////////////////////////// // // Version 1.0 - Nov 24, 2010 // // Delevoped by Robert Scheitlin // //////////////////////////////////////////////////////////////////////////////// package com.esri.viewer.utils { public class GlobalVarContainer { public var vars:Object = {}; public var searchurl:String = "" ; private static var _container:GlobalVarContainer; private static var _lock:Boolean = false; public static function getInstance():GlobalVarContainer { if (!_lock) { _container = new GlobalVarContainer(); _lock = true; } return _container; } } }and set it like thisGlobalVarContainer.getInstance().searchurl = "Blah blah";and retrieve it like thisx = GlobalVarContainer.getInstance().searchurl;
JR Dira, I can not duplicate your results. What is your spatialReference in your SearchWidget.xml?<spatialReference>102003</spatialReference>
JR Dira, Are you sure you are using Version 2.1.6?
Caitlin, I actually found the error to exist in both the graphical and text search in my code. I will attempt to release a bug fix version ASAP.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.