Equivalent function for box3d which available in Postgis

I have a road_network data I am trying to
obtain all the values within a bounding box formed by lat long values,
i tried below example but it compiled and produces some error 
declare @exmp varchar;
set @exmp = 'POLYGON(81.959545899804 25.243612186501,81.985879306176 25.2726072490010)'
DECLARE @box geography = geography::STLineFromText(@exmp, 4326)
SELECT source,target,geog4326.STAsText()
FROM road_network
WHERE geog4326.STIntersects(@box) = 1;
in PostGIS theres a box3d, i like to know is there any equivalent function available in MS SQL Server ?

a few problems here:
1.
run this- what do you see?
declare @exmp varchar;
set @exmp
= 'POLYGON(81.959545899804 25.243612186501,81.985879306176 25.2726072490010)'
print @exmp
a varchar initialised without a size defaults to varchar(1)
so set varchar to the required value or set it to varchar(max)
2. A polygon requires at least 3 distinct points and the start and end points need to be the same. I'm assuming you just want to draw a line between the 1st & 3rd points of your bounding box and have the db engine draw the box around them. So you should
be declaring it as a LINESTRING, not a polygon. Unfortunately geography doesn't have a .STEnvelope() function, so you'll need to convert the line to geometry, get the envelope, then convert back
declare @exmp varchar(max);
set @exmp = 'LINESTRING(81.959545899804 25.243612186501, 81.985879306176 25.2726072490010)'
DECLARE @box geography = geography::STLineFromText(@exmp, 4326)
-- Work out bounding box by converting to geometry via WKB, then using STEnvelope()
DECLARE @boundingbox geometry = geometry::STGeomFromWKB(@box.STAsBinary(), @box.STSrid).STEnvelope();
-- Convert result back to geography via WKB
SET @box = geography::STGeomFromWKB(@boundingbox.STAsBinary(), @boundingbox.STSrid);
(from
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/453d2fe8-bbe6-4047-90ce-556015c17e64/how-to-get-the-bounding-rectangle-of-a-geography)
now you can intersect your @box.
If this were geometry you could've just used .STFilter() on your linestring directly.. I'm not sure how .Filter() works with geography but investigate it as it'll be faster if your road_network table has correct spatial indexes.
Jakub @ Adelaide, Australia

Similar Messages

  • Formatting function for columns which store japanese characters

    I have a table which stores names in all languages.I have a SQL Report.When the names are in English the formatting is good.But when the names are in Japanese.The formatting is going wrong.
    A part of SQL report is as follows
    COLUMN emp_name formata20
    COLUMN mgr_name formata20
    select emp_name,mgr_name
    from employee;
    The data in the columns are coming in ZigZag fashions.I tried using ltrim and rtrim but had no impact.Are there any functions which would help in formatting the query.I need this very urgently.
    Thanks in advance

    Change your environment variable 'nls_lang' appropriately to reflect the language.
    For example on my computer, this variable has the value
    American_America.WE8ISO8859P1
    Typically NLS_LANG environment variable is of type:
    language_territory.charset
    If you are using Japanese character set, you could specify the environment variable as:
    JAPANESE_JAPAN.JA16EUC
    Please go through Oracle's Globalization Support Guide for additional information.

  • I found the update function for Genius which is hidden in the Store menu but not in the actually Store. I repeatedly update Genius, get the message that it is communicating with Apple, then that Genius is updated but it never works. What gives?

    Repeted updates to Genius do nothing. I always get an error message for all 13,000 songs I have. My disc drive crashed and its taken months to reload click by click every song from the cloud or my computer. iTunes repeatedly crashes if you try to load more than about 50 songs at a time, and always crashes around the 200th song. All my playlists were erased and when I synch one of my two iPods everything on that was erased including all the play lists, I don't ever want to synch my other iPod because it still has dozens of my play lists that it took years to create based on 13,000 songs. So warning iTunes totally ***** if this ever happens to you. My Zune account on the other hand was fine. Anyway back to the question at hand - Genius use to work for my collection. Genius still works for the iPod which I will never synch again, why doesn't it work for my collection now despite repeated updates. Suppose its just another buggy Apple piece of software. BTW don't ever use Apple's iCloud it eats your entire music collection, erases it from you computer and then doles it out one click at a time from the cloud - another stupid piece of software from the geniuses at Apple. But why am I surprised Apple destroyed the record industry, so why not destroy everyone's CD collection and just reduce us all to slaves of iTunes and its magic. I'm sick of Apple and its bloated reputation for great software.

    Download the Windows Installer CleanUp utility from the following page (use one of the links under the "DOWNLOAD LOCATION" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    To install the utility, doubleclick the msicuu2.exe file you downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up").
    In the list of programs that appears in CleanUp, select any QuickTime entries and click "Remove", as per the following screenshot:
    Quit out of CleanUp, restart the PC. Now try another QuickTime install (Version 7.7.1). Does it go through properly this time?

  • Which availability check procedure will be approprite for Pharma industries

    Hello All,
    I am working with a Pharma client.
    Please suggest me which availability check procedure will be approprite for Pharma industries.
    Depending ATP or On Product Allocation.
    Thanking you in anticipation.
    Regards
    Venkat

    Hi,
    ATP is a basic availability check which have limited functionality. GATP is a more dynamic checking which is suitable for real-time availability check, which is more appropriate for pharmaceutical industry.
    The basic differences between the two checking systems are:
    APO GATP:
    - Check for several Online Transaction Processing (OLTP)
    - Uses Live Cache Technology
    - Advanced Basic method
    - No restriction for combination of basic methods
    - Rules-based substitution
    - ATP check in several locations ("global")
    - Advanced backorder processing
    - Call of production possible
    ERP ATP:
    - Check possible only in an ERP system
    - Uses database tables or shared buffer (ERP server)
    - Basic methods
    - Restriction for combinations of basic methods
    - Standard substitutions
    - Check only in one location
    - Restricted backorder processing
    - No call of production possible
    This topic has been discussed before in the forum.
    You may find the following thread relevant to you:
    GATP
    Thanks.

  • Is there a good video available for beginners which will show what Photoshop can do?

    I'm trying to find a good video which will give a general introduction to what Photoshop can do - not how to do it - for a group of beginners at our local photographic society.
    Ideally I'm looking for something which lasts 15 - 20 minutes and will demonstrate how Photoshop can be used for correcting and manipulating images, plus a short section on how it can be used more creatively.
    Is anyone aware of such a video which is preferably free to use (with obvious credits), and where it's available from?

    There are multiuser/multiplatform apps that you can use to manage your photos that can view multiple source photos.  I use  Media Pro 1.  However, you can't use iPhoto and MP on the same set of original/source image files.
    I use MP as my primary DAM (digital asset management) application and iPhoto just for special projects like books, calendars, cards, etc.
    OT

  • Is there a available function for T-CODE: CC07

    Hello:
         Is there a available function for T-CODE: CC07 . or a function for  program RCS00160??
    thanks a lot.

    Hi
    I didnt get your question. may i knw whether u need a function module or ur question is different?if you need a function module then the followinf fms are available
    CALL FUNCTION 'CSCO_BOM_DISPLAY'
    CALL FUNCTION 'EQUIPMENT_CHECK'
    CALL FUNCTION 'CUKD_GET_RELATIONS_FOR_OBJECT'
    CALL FUNCTION 'CUKD_GET_KNOWLEDGE'
    CALL FUNCTION 'FUNC_LOCATION_READ'
    CALL FUNCTION 'CLMA_CLASS_EXIST'  and 
    many more....
    Regards,
    Samanth

  • What is the JSp equivalent method for PHP isset function

    Hai guys,
    can u tell me the JSP equivalent method for PHP isset function.

    isset checks what? parameters?
    if(request.getParameter("paramname") != null) {                                                                                                                                                                               

  • My appstore app shows an update available for CodeBox, which I did not buy, does anyone know what the problem could be? I don't think I have been hacked (no money subtracted, etc.)

    Hi all,
    For some time now, my appstore app shows an update available for CodeBox, which I did not buy. When I try to update it it asks for my ID and password (all normal), but then it gives an Unknown Error.
    I am 100% sure I didn't buy the app, I do not see any transaction on my card or in the appstore apart of this one, so does not seem to be a hack.
    Does anyone know what is happening, this is a tricky thing which is making me lose trust in the payment/account system that Apple is using.
    Thanks!
    Isidro

    well... actually you are right dahveed, i had a dodgy copy of galaxy on fire 2 (boring game), that's what was giving me the issue. i followed your posts about the MAS etc., and discovered this was the problem. Corrected. You're a knowledgable man, thank you

  • Equivalent Class for Function Module for VIEW_MAINTENANCE_CALL

    Hi Gurus,
    Can any one let me know
    Equivalent Class for Function Module for VIEW_MAINTENANCE_CALL
    Thanks in a

    Try Class:
    CL_TABLECONTROL
    Or do check if this class is of any use:
    CL_SALV_FULLSCREEN_ADAPTER

  • How can apple send out an os update that renders an important function of the software/hardware to not work? They knowingly have sent out this new os update for iPad which makes airplay nonfunctining! I need this for my business!

    How can apple send out an os update that renders an important function of the software/hardware to not work? They knowingly have sent out this new os update for iPad which makes airplay nonfunctining! I need this for my business!  I could understand if they didn't know, but it is all over the Internet! When I went in to have it revert back to os6 (which worked fine!) I was actually asked if I had done any research before I installed the upgrade! As if this is the consumer's fault for being dumb enough to fall for the upgrade!

    That is not what I have discovered, nor what others have discovered, nor what I was told when I went the Genius Bar.  I cannot remotely mirror to my MacBook Pro and it only started the day after I installed the upgrade.  We tested it with an iPad that had not been upgraded, no problem.

  • Hey there, is there an app for I tunes available which displays the song lyrics. If not it would be a good idea

    Hey there, is there an app for I tunes available which displays the song lyrics. If not it would be a good idea

    If the lyrics aren't in the ID3 tags (track info) they won't display.
    https://www.macupdate.com/app/mac/25390/get-lyrical  THAT may or may not work. It's a pretty old link.

  • NI reset function for NI USB device available?

    Hi Just wondering if NI does provide reset function for any NI USB device?
    Just checking before purchasing NI USB device.
    regards,
    Clement

    Hi Clement,
    To add to what Mike said, you will be able to reset the USB device using the DAQmx driver. There are two ways to access this, using the DAQmx application programming interface (API) or in Measurement and Automation Explorer (which gets installed with DAQmx). The DAQmx Reset Device function immediately aborts all running tasks
    associated with the device. This action stops and releases any
    resources reserved for a task, such as trigger routes.
    Regards,
    Kent
    Applications Engineer
    Digital Multimeter Home

  • T440s - Enhanced functions for this application are available

    Every time I open one of the Lenovo apps like like Support or Companion, I get the message "Enhanced functions for this application are available".  I click the message, a browser opens up, I download "dependecypackage.exe", I install, setup asks for a restart and I let it, and the process repeats again and again.  I keep getting this "Enhanced functions..." message.  It is driving me crazy.  How do I end this cycle?
    T440s
    i5-4300U
    4GB RAM
    256GB SSD
    Factory Win 8 upgraded to Win 8.1
    Solved!
    Go to Solution.

    Hi larrykl,
    Try manually installing the latest version of Lenovo Settings Dependency. You need both Lenovo Dependency and Lenovo Settings Dependency for all the Windows 8 apps to work.
    Tell us how it goes!
    I don't work for Lenovo. I'm a crazy volunteer!

  • "Extract" filter or equivalent function

    Where do I find the "Extract" filter or equivalent function found on earlier versions of Photoshop?

    Norm, you'll have noticed the video is one of those super easy images they used to demo Refine Edge when it was first available?  I struggled with the tool for ages back then, finding a far from intuitive tool to use in real world situations, which is why I often use the Martin Evening tutorial on this forum, because he demos a difficult image, plus he shows how best you use it in the target image.  But I decided to make it look easy in my post above

  • Multiple Partner Functions for a Sales document Item

    Hi,
    Can you please advise on modeling scenario for showing multiple partner functions for a given sales document in BI Report ..
    Because Key figure values should not be distributed for multiple records just becos of multiple partner functions but users want to see them in the reports along with sales doc and key figure
    I am explaining bit more clearly...
    I can achieve above requirement by having below model ..
    SDOC     ITEM  PF1  PF2  PF3  AMOUNT
    1000       10      AB    CD   EF    50000
    PF : Partner Function
    but as I feel it is a complicated task  to add more and more columns fro partner functions as and when new partner functions have been added or requested to show by users at sales doc level...
    So Can you please advise a better solution to meet the same requirement.
    Thanks & Regards,
    BRK
    Please advise me on this scenario
    Thanks & Regards,
    BRK
    Edited by: BRK on Jul 22, 2008 9:19 AM
    Edited by: BRK on Jul 22, 2008 9:29 AM

    SalesDoc______Item_______PartnerFunction________Amount
    80000_________10_____________A1_______________$1000
    80000_________10_____________A2_______________$1000
    80000_________10_____________A3_______________$1000
    This will be the normal display in the cube if there is only one Partner Function.
    But what we need is
    SalesDoc______Item_______PartnerFunction________Amount
    80000_________10_____________A1_______________$1000
    80000_________10_____________A2_________________' '
    80000_________10_____________A3_________________' '
    The Amount (KF) should be populated only for the first record for a SalesDoc / Item combo.
    You load data from source to the ODS, say delta.
    Suppose that the below record is already available in the ODS.
    SalesDoc______Item_______PartnerFunction________Amount
    80000_________10_____________A1_______________$1000
    And you get the following data as DELTA in the Data_Package from the source.
    SalesDoc______Item_______PartnerFunction________Amount
    80000_________10_____________A2_______________$1000
    80000_________10_____________A3_______________$1000
    If you populate the Amount again for these 2 records, then the total would sum to $3000, which is wrong.
    So what we do is,
    Write a Select stmt for ALL ENTRIES in Data_Package and fetch the records from the target ODS. Have it in an Internal table, say t_ODS1
    Take the SalesDoc / Item from the Data_Package and chk if it is present in the internal table t_ODS1.
    If it is present, then populate the Amount as ' ' (Blank)
    Else populate the Amount as $1000.
    Say, you are getting 3 new records, which is not present in the ODS1.
    In that case, your internal table t_ODS1 will be blank.
    Now again, we need to populate the Amount only for the first record among the 3 records.
    So, here comes the "Flag".
    Set the Flag as X, when we populate the Amount.
    Everytime chk the Flag <> X.
    Only if it is <> X, populate the Amount.
    Else Leave it Balnk.
    Hope I have explained in detail
    Regards,
    Balaji V

Maybe you are looking for

  • Satellite Pro L300 - DVD drive error code 10 on Vista.

    Can't see DVD drive on "my computer" Under device manager its showing drive but with yellow triange, after looking at info, the device status is "This device cannot start. (Code 10)" tried restarting 2 times. Thats not working. Also cheaked drivers,

  • Add a new column to an "Insert Form" created by HTMLDB Wizard throws Error

    Hi, My table design has changed and I had to add 2 new columns. The corresponding Insert Form/Report/Update Forms created by the HTMLDB should now reflect the new columns that have been added. In report and update forms I did not have a problem but i

  • [JS] (CS2) (CS3) Test for container

    Hello, I would like to make sure that whatever I have selected (app.selection) is the container and NOT the content, regardless of what the selection is (Item or Text). I know if you have multiple selections, you can only have objects and that is fin

  • No emails in my gmail inbox

    i have created my gmail account on my Nokia C5, all my other folders have mail in them apart from my inbox. Could someone please assist me on what to do as all my other email accounts are working fine.

  • File System Permissions Don't Allow "Staff" Group

    This is just one of the many frustrations I've been having with my new Macbook Retina. I've had a macbook for 2.5 years at home, and it seems in the context of a corporate environment, Mac's are incredibly frustrating. Not to go on a rant (which I in